summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2014-02-12 10:28:53 -0500
committerTingPing <tingping@tingping.se>2014-02-12 10:31:11 -0500
commitb17c0276de4da4cd75114d7e1c67738f894ad59e (patch)
treed6a9a824d704b8bdee5c2a1800b0fbffa1bd4b46 /src/common
parentba399eb7f9f788f2a261f1e912be79f742fd2070 (diff)
Fix some leaks
Diffstat (limited to 'src/common')
-rw-r--r--src/common/cfgfiles.c3
-rw-r--r--src/common/dcc.c3
-rw-r--r--src/common/text.c3
-rw-r--r--src/common/util.c3
4 files changed, 12 insertions, 0 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index 47cc9677..59761bc5 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -1029,6 +1029,7 @@ save_config (void)
 
 	if (!cfg_put_str (fh, "version", PACKAGE_VERSION))
 	{
+		close (fh);
 		g_free (new_config);
 		return 0;
 	}
@@ -1041,6 +1042,7 @@ save_config (void)
 		case TYPE_STR:
 			if (!cfg_put_str (fh, vars[i].name, (char *) &prefs + vars[i].offset))
 			{
+				close (fh);
 				g_free (new_config);
 				return 0;
 			}
@@ -1049,6 +1051,7 @@ save_config (void)
 		case TYPE_BOOL:
 			if (!cfg_put_int (fh, *((int *) &prefs + vars[i].offset), vars[i].name))
 			{
+				close (fh);
 				g_free (new_config);
 				return 0;
 			}
diff --git a/src/common/dcc.c b/src/common/dcc.c
index ca1be140..169a0f76 100644
--- a/src/common/dcc.c
+++ b/src/common/dcc.c
@@ -1805,7 +1805,10 @@ dcc_send (struct session *sess, char *to, char *file, int maxcps, int passive)
 
 	dcc = new_dcc ();
 	if (!dcc)
+	{
+		free (file);
 		return;
+	}
 	dcc->file = file;
 	dcc->maxcps = maxcps;
 
diff --git a/src/common/text.c b/src/common/text.c
index 1afb0c18..a01fc2c8 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -1659,7 +1659,10 @@ pevent_load (char *filename)
 	if (fd == -1)
 		return 1;
 	if (fstat (fd, &st) != 0)
+	{
+		close (fd);
 		return 1;
+	}
 	ibuf = malloc (st.st_size);
 	read (fd, ibuf, st.st_size);
 	close (fd);
diff --git a/src/common/util.c b/src/common/util.c
index 32082fe1..dec9d4df 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1404,7 +1404,10 @@ util_exec (const char *cmd)
 #ifndef WIN32
 	pid = fork ();
 	if (pid == -1)
+	{
+		free (argv);
 		return -1;
+	}
 	if (pid == 0)
 	{
 		/* Now close all open file descriptors except stdin, stdout and stderr */