# HG changeset patch # User Rob Landley # Date 1413852965 18000 # Node ID e127aa575ff25c4ad3309f037bee7da6ddd5a832 # Parent ec07449e8e4af2701ef433adff65039e3f58254d More static analysis fixes from Ashwini Sharma. diff -r ec07449e8e4a -r e127aa575ff2 lib/xwrap.c --- a/lib/xwrap.c Mon Oct 20 19:52:29 2014 -0500 +++ b/lib/xwrap.c Mon Oct 20 19:56:05 2014 -0500 @@ -94,6 +94,7 @@ va_start(va, format); vprintf(format, va); + va_end(va); if (fflush(stdout) || ferror(stdout)) perror_exit("write"); } diff -r ec07449e8e4a -r e127aa575ff2 toys/other/netcat.c --- a/toys/other/netcat.c Mon Oct 20 19:52:29 2014 -0500 +++ b/toys/other/netcat.c Mon Oct 20 19:56:05 2014 -0500 @@ -166,7 +166,6 @@ if (!child && toys.optc) { int fd = pollfds[0].fd; - if (!temp) close(sockfd); dup2(fd, 0); dup2(fd, 1); if (toys.optflags&FLAG_L) dup2(fd, 2); diff -r ec07449e8e4a -r e127aa575ff2 toys/pending/modprobe.c --- a/toys/pending/modprobe.c Mon Oct 20 19:52:29 2014 -0500 +++ b/toys/pending/modprobe.c Mon Oct 20 19:56:05 2014 -0500 @@ -178,15 +178,21 @@ line = NULL; linelen = nxtlinelen = 0; len = getline(&line, (size_t*)&linelen, fl); - if (len <= 0) return len; + if (len <= 0) { + free(line); + return len; + } // checking for commented lines. if (line[0] != '#') break; free(line); } for (;;) { if (line[len - 1] == '\n') len--; - // checking line continuation. - if (!len || line[len - 1] != '\\') break; + if (!len) { + free(line); + return len; + } else if (line[len - 1] != '\\') break; + len--; nxtlen = getline(&nxtline, (size_t*)&nxtlinelen, fl); if (nxtlen <= 0) break; diff -r ec07449e8e4a -r e127aa575ff2 toys/posix/nohup.c --- a/toys/posix/nohup.c Mon Oct 20 19:52:29 2014 -0500 +++ b/toys/posix/nohup.c Mon Oct 20 19:56:05 2014 -0500 @@ -28,8 +28,10 @@ S_IRUSR|S_IWUSR )) { char *temp = getenv("HOME"); + temp = xmprintf("%s/%s", temp ? temp : "", "nohup.out"); xcreate(temp, O_CREAT|O_APPEND|O_WRONLY, 0600); + free(temp); } } if (isatty(0)) {