Fix some leaks

This commit is contained in:
TingPing 2014-02-12 10:28:53 -05:00
parent ba399eb7f9
commit b17c0276de
6 changed files with 16 additions and 0 deletions

View File

@ -756,6 +756,7 @@ XS (XS_HexChat_send_modes)
}
if (target_count == 0) {
free (targets);
XSRETURN_EMPTY;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -176,6 +176,9 @@ userlist_button_cb (GtkWidget * button, char *cmd)
if (num_sel < 1)
{
nick_command_parse (sess, cmd, "", "");
if (nicks)
free (nicks);
return;
}
}