summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorRichardHitt <rbh00@netcom.com>2013-01-09 14:37:57 -0800
committerRichardHitt <rbh00@netcom.com>2013-01-09 14:37:57 -0800
commit6beef589e32d874e5d961e7e6f7b2a68c56538bd (patch)
treec27f129c1011d63570295117ea6cabd5e25e65f8 /src/common
parent285ddd0b60974bebbee6ea6168bf8d53262f6145 (diff)
Make source cleah with cppcheck, except for mpc and sasl
Diffstat (limited to 'src/common')
-rw-r--r--src/common/dcc.c3
-rw-r--r--src/common/outbound.c2
-rw-r--r--src/common/server.c1
-rw-r--r--src/common/util.c11
4 files changed, 15 insertions, 2 deletions
diff --git a/src/common/dcc.c b/src/common/dcc.c
index d404b617..9014296e 100644
--- a/src/common/dcc.c
+++ b/src/common/dcc.c
@@ -322,6 +322,7 @@ dcc_lookup_proxy (char *host, struct sockaddr_in *addr)
 		memcpy (&addr->sin_addr, h->h_addr, 4);
 		memcpy (&cache_addr, h->h_addr, 4);
 		cache_host = strdup (host);
+		/* cppcheck-suppress memleak */
 		return TRUE;
 	}
 
@@ -788,6 +789,7 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
 			dcc_send_ack (dcc);
 			dcc_close (dcc, STAT_DONE, FALSE);
 			dcc_calc_average_cps (dcc);	/* this must be done _after_ dcc_close, or dcc_remove_from_sum will see the wrong value in dcc->cps */
+			/* cppcheck-suppress deallocuse */
 			sprintf (buf, "%d", dcc->cps);
 			EMIT_SIGNAL (XP_TE_DCCRECVCOMP, dcc->serv->front_session,
 							 dcc->file, dcc->destfile, dcc->nick, buf, 0);
@@ -1533,6 +1535,7 @@ dcc_handle_new_ack (struct DCC *dcc)
 		dcc->ack = dcc->size;	/* force 100% ack for >4 GB */
 		dcc_close (dcc, STAT_DONE, FALSE);
 		dcc_calc_average_cps (dcc);	/* this must be done _after_ dcc_close, or dcc_remove_from_sum will see the wrong value in dcc->cps */
+		/* cppcheck-suppress deallocuse */
 		sprintf (buf, "%d", dcc->cps);
 		EMIT_SIGNAL (XP_TE_DCCSENDCOMP, dcc->serv->front_session,
 						 file_part (dcc->file), dcc->nick, buf, NULL, 0);
diff --git a/src/common/outbound.c b/src/common/outbound.c
index a8a65d6a..f8f73dd6 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -1866,7 +1866,6 @@ cmd_exec (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 			/* not reached unless error */
 			/*printf("exec error\n");*/
 			fflush (stdout);
-			fflush (stdin);
 			_exit (0);
 		}
 		if (pid == -1)
@@ -1876,6 +1875,7 @@ cmd_exec (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 			PrintText (sess, "Error in fork(2)\n");
 			close(fds[0]);
 			close(fds[1]);
+			free (s);
 		} else
 		{
 			/* Parent path */
diff --git a/src/common/server.c b/src/common/server.c
index 1fd04422..6ddaa18d 100644
--- a/src/common/server.c
+++ b/src/common/server.c
@@ -1678,6 +1678,7 @@ xit:
 #endif
 
 	return 0;
+	/* cppcheck-suppress memleak */
 }
 
 static void
diff --git a/src/common/util.c b/src/common/util.c
index 55cb530a..38537402 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1319,8 +1319,17 @@ int my_poptParseArgvString(const char * s, int * argcPtr, char *** argvPtr) {
 	    if (*argv[argc]) {
 		buf++, argc++;
 		if (argc == argvAlloced) {
+		    char *temp[];
 		    argvAlloced += POPT_ARGV_ARRAY_GROW_DELTA;
-		    argv = realloc(argv, sizeof(*argv) * argvAlloced);
+		    temp = realloc(argv, sizeof(*argv) * argvAlloced);
+		    if (temp)
+			argv = temp;
+		    else
+		    {
+			free(argv);
+			free(bufStart);
+			return 1;
+		    }
 		}
 		argv[argc] = buf;
 	    }