* make the readbuffer freeing/allocing more consistant.
authorWilfried Göesgens <willi@citadel.org>
Tue, 17 Feb 2009 20:03:12 +0000 (20:03 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 17 Feb 2009 20:03:12 +0000 (20:03 +0000)
webcit/webcit.c

index 8647deec2b3fc7aefb5a8b24963b41b4b5462ebb..74d3469bb8d93cb788d30f786a401343290e96d6 100644 (file)
@@ -788,7 +788,8 @@ void session_loop(HashList *HTTPHeaders, StrBuf *ReqLine, StrBuf *request_method
         * connection now.
         */
        if (!WCC->connected) {
-               WCC->ReadBuf = NewStrBuf();
+               if (WCC->ReadBuf == NULL)
+                       WCC->ReadBuf = NewStrBuf();
                if (!strcasecmp(ctdlhost, "uds")) {
                        /* unix domain socket */
                        snprintf(buf, SIZ, "%s/citadel.socket", ctdlport);
@@ -801,6 +802,7 @@ void session_loop(HashList *HTTPHeaders, StrBuf *ReqLine, StrBuf *request_method
 
                if (WCC->serv_sock < 0) {
                        do_logout();
+                       FreeStrBuf(&WCC->ReadBuf);
                        goto SKIP_ALL_THIS_CRAP;
                }
                else {