]> git.marmaro.de Git - mmh/commitdiff
Fixed programming mistakes, detected by cppcheck.
authormarkus schnalke <meillo@marmaro.de>
Wed, 28 Mar 2012 19:16:08 +0000 (21:16 +0200)
committermarkus schnalke <meillo@marmaro.de>
Wed, 28 Mar 2012 19:16:08 +0000 (21:16 +0200)
Two memory leaks and a possibly not terminated string.
(There also is a false positive in sbr/path.c.)
(sbr/dtimep.c has warnings, but I believe lex is correct. ;-) )

sbr/folder_read.c
uip/inc.c
uip/slocal.c

index 8ccffc503adaee01e327dbb156dc72c34f107c1e..e4c1b7f71642641158a99d2ee1c8846a85d4476c 100644 (file)
@@ -38,6 +38,7 @@ folder_read(char *name)
 
        if (stat(name, &st) == -1) {
                free(name);
+               closedir(dd);
                return NULL;
        }
 
index ee51219760a8f0e2bf42b51a7c6f14e17d138a2c..5142ae3ab5e2092bc2d8e785ef3ea1f23129ebcb 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -437,6 +437,7 @@ main(int argc, char **argv)
                */
                break;
        }
+       free(maildir_copy);
 
        if (incerr < 0) {  /* error */
                if (locked) {
index b83a2686ad08bf2c61d21d6692dcc77a331110cc..765bcbd621cde808dc44353f28b08b92b19210ad 100644 (file)
@@ -1107,6 +1107,7 @@ get_sender(char *envelope, char **sender)
 
        i = strlen("From ");
        strncpy(buffer, envelope + i, sizeof(buffer));
+       buffer[sizeof buffer -1] = '\0';  /* ensure termination */
        if ((cp = strchr(buffer, '\n'))) {
                *cp = '\0';
                cp -= 24;