Fixed a memory allocation problem
authorArt Cancro <ajc@citadel.org>
Fri, 4 Apr 2008 03:52:55 +0000 (03:52 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 4 Apr 2008 03:52:55 +0000 (03:52 +0000)
webcit/messages.c

index 6ea3c8fc00ff0fcb621283a4ffcd15c4f36bc79f..f9e0ae7677adc31fd9eb68095baf191f774f681c 100644 (file)
@@ -3008,7 +3008,7 @@ void post_message(void)
        urlcontent *u;
        void *U;
        char buf[1024];
-       char *encoded_subject = "";
+       char *encoded_subject = NULL;
        static long dont_post = (-1L);
        struct wc_attachment *att, *aptr;
        int is_anonymous = 0;
@@ -3141,7 +3141,7 @@ void post_message(void)
                snprintf(CmdBuf, len + 1, CMD,
                        Recp,
                        is_anonymous,
-                       encoded_subject,
+                       (encoded_subject ? encoded_subject : ""),
                        display_name,
                        Cc,
                        Bcc,
@@ -3152,7 +3152,7 @@ void post_message(void)
                serv_puts(CmdBuf);
                serv_getln(buf, sizeof buf);
                free (CmdBuf);
-               free (encoded_subject);
+               if (encoded_subject) free(encoded_subject);
                if (buf[0] == '4') {
                        post_mime_to_server();
                        if (  (!IsEmptyStr(bstr("recp")))