From: Erik Hovland Date: Tue, 7 Apr 2009 09:32:20 +0000 (+0200) Subject: Try to correct usage of tempfile and *tempfile X-Git-Tag: mutt-1-5-20-rel~123 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e10b2f66c7453de071f388267579cdafa2aaa611;p=mutt Try to correct usage of tempfile and *tempfile Since tempfile is a double pointer checking for tempfile and then dereferencing with *tempfile is not correct. --- diff --git a/ChangeLog b/ChangeLog index 2cd9f82f..46e672c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-04-06 22:05 +0200 Rocco Rutte (d639baaf57fb) + + * doc/manual.xml.head: Manual: Fix typo + +2009-04-06 19:10 +0200 Erik Hovland (4fe35e9984ba) + + * ChangeLog, sendlib.c: mutt_message_to_7bit(): Only close file + pointer if we opened it + + The pointer is to be managed outside the function and provided. Only + close it we opened it ourself using fopen(). + 2009-04-06 19:07 +0200 Erik Hovland (b5cbd0dab863) * sendlib.c: Plug memory leaks in sendlib.c diff --git a/sendlib.c b/sendlib.c index 64d21b76..873e3e54 100644 --- a/sendlib.c +++ b/sendlib.c @@ -2027,7 +2027,7 @@ send_msg (const char *path, char **args, const char *msg, char **tempfile) } unlink (msg); - if (SendmailWait >= 0 && tempfile) + if (SendmailWait >= 0 && tempfile && *tempfile) { /* *tempfile will be opened as stdout */ if (open (*tempfile, O_WRONLY | O_APPEND | O_CREAT | O_EXCL, 0600) < 0) @@ -2079,7 +2079,7 @@ send_msg (const char *path, char **args, const char *msg, char **tempfile) if (waitpid (pid, &st, 0) > 0) { st = WIFEXITED (st) ? WEXITSTATUS (st) : S_ERR; - if (SendmailWait && st == (0xff & EX_OK) && tempfile) + if (SendmailWait && st == (0xff & EX_OK) && tempfile && *tempfile) { unlink (*tempfile); /* no longer needed */ FREE (tempfile); /* __FREE_CHECKED__ */ @@ -2089,7 +2089,7 @@ send_msg (const char *path, char **args, const char *msg, char **tempfile) { st = (SendmailWait > 0 && errno == EINTR && SigAlrm) ? S_BKG : S_ERR; - if (SendmailWait > 0 && tempfile) + if (SendmailWait > 0 && tempfile && *tempfile) { unlink (*tempfile); FREE (tempfile); /* __FREE_CHECKED__ */ @@ -2100,7 +2100,7 @@ send_msg (const char *path, char **args, const char *msg, char **tempfile) alarm (0); sigaction (SIGALRM, &oldalrm, NULL); - if (kill (ppid, 0) == -1 && errno == ESRCH && tempfile) + if (kill (ppid, 0) == -1 && errno == ESRCH && tempfile && *tempfile) { /* the parent is already dead */ unlink (*tempfile);