Merge branch 'master' into pull350

This commit is contained in:
RichardHitt 2013-01-10 02:14:02 -08:00
commit bf673072e8
11 changed files with 29 additions and 10 deletions

View File

@ -105,6 +105,7 @@ sha256_file (char *path, char outputBuffer[65])
if (!buffer) if (!buffer)
{ {
fclose (file);
return ENOMEM; return ENOMEM;
} }

View File

@ -2137,6 +2137,7 @@ Command_PyReload(char *name)
char *filename = strdup(plugin->filename); char *filename = strdup(plugin->filename);
Command_PyUnload(filename); Command_PyUnload(filename);
Command_PyLoad(filename); Command_PyLoad(filename);
/* cppcheck-suppress deallocDealloc */
g_free(filename); g_free(filename);
} }
} }

View File

@ -37,7 +37,6 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo
free_space = *free_k; free_space = *free_k;
total_space = *total_k; total_space = *total_k;
result = malloc(bsize * sizeof(char)); result = malloc(bsize * sizeof(char));
bytesize = malloc(3 * sizeof(char));
const char *quantities = "KB\0MB\0GB\0TB\0PB\0EB\0ZB\0YB\0"; const char *quantities = "KB\0MB\0GB\0TB\0PB\0EB\0ZB\0YB\0";
int i=0; int i=0;
if (total_space == 0) if (total_space == 0)
@ -45,6 +44,7 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo
snprintf(result, bsize, "%s: none", desc); snprintf(result, bsize, "%s: none", desc);
return result; return result;
} }
bytesize = malloc(3 * sizeof(char));
while (total_space > 1023 && i <= 14) while (total_space > 1023 && i <= 14)
{ {
i=i+3; i=i+3;
@ -61,6 +61,7 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo
else else
snprintf(result, bsize, "%s: %.1f%s/%.1f%s free", snprintf(result, bsize, "%s: %.1f%s/%.1f%s free",
desc, free_space, bytesize, total_space, bytesize); desc, free_space, bytesize, total_space, bytesize);
free (bytesize);
return result; return result;
} }

View File

@ -394,6 +394,7 @@ int xs_parse_distro(char *name)
char keywords[bsize]; char keywords[bsize];
while(fgets(buffer, bsize, fp) != NULL) while(fgets(buffer, bsize, fp) != NULL)
find_match_char(buffer, "ACCEPT_KEYWORDS", keywords); find_match_char(buffer, "ACCEPT_KEYWORDS", keywords);
/* cppcheck-suppress uninitvar */
if (strstr(keywords, "\"") == NULL) if (strstr(keywords, "\"") == NULL)
snprintf(buffer, bsize, "Gentoo Linux (stable)"); snprintf(buffer, bsize, "Gentoo Linux (stable)");
else else
@ -440,16 +441,14 @@ int xs_parse_hwmon_chip(char *chip)
int xs_parse_hwmon_temp(char *temp, unsigned int *sensor) int xs_parse_hwmon_temp(char *temp, unsigned int *sensor)
{ {
unsigned int *value; unsigned int value;
float celsius; float celsius;
value = malloc(sizeof(int));
if (!hwmon_chip_present()) if (!hwmon_chip_present())
return 1; return 1;
else else
get_hwmon_temp(value, sensor); get_hwmon_temp(&value, sensor);
celsius = (float)*value; celsius = (float)value;
snprintf(temp, bsize, "%.1fC", celsius/1000.0); snprintf(temp, bsize, "%.1fC", celsius/1000.0);
free(value);
return 0; return 0;
} }

View File

@ -322,6 +322,7 @@ dcc_lookup_proxy (char *host, struct sockaddr_in *addr)
memcpy (&addr->sin_addr, h->h_addr, 4); memcpy (&addr->sin_addr, h->h_addr, 4);
memcpy (&cache_addr, h->h_addr, 4); memcpy (&cache_addr, h->h_addr, 4);
cache_host = strdup (host); cache_host = strdup (host);
/* cppcheck-suppress memleak */
return TRUE; return TRUE;
} }
@ -788,6 +789,7 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
dcc_send_ack (dcc); dcc_send_ack (dcc);
dcc_close (dcc, STAT_DONE, FALSE); 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 */ 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); sprintf (buf, "%d", dcc->cps);
EMIT_SIGNAL (XP_TE_DCCRECVCOMP, dcc->serv->front_session, EMIT_SIGNAL (XP_TE_DCCRECVCOMP, dcc->serv->front_session,
dcc->file, dcc->destfile, dcc->nick, buf, 0); 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->ack = dcc->size; /* force 100% ack for >4 GB */
dcc_close (dcc, STAT_DONE, FALSE); 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 */ 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); sprintf (buf, "%d", dcc->cps);
EMIT_SIGNAL (XP_TE_DCCSENDCOMP, dcc->serv->front_session, EMIT_SIGNAL (XP_TE_DCCSENDCOMP, dcc->serv->front_session,
file_part (dcc->file), dcc->nick, buf, NULL, 0); file_part (dcc->file), dcc->nick, buf, NULL, 0);

View File

@ -1866,7 +1866,6 @@ cmd_exec (struct session *sess, char *tbuf, char *word[], char *word_eol[])
/* not reached unless error */ /* not reached unless error */
/*printf("exec error\n");*/ /*printf("exec error\n");*/
fflush (stdout); fflush (stdout);
fflush (stdin);
_exit (0); _exit (0);
} }
if (pid == -1) 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"); PrintText (sess, "Error in fork(2)\n");
close(fds[0]); close(fds[0]);
close(fds[1]); close(fds[1]);
free (s);
} else } else
{ {
/* Parent path */ /* Parent path */
@ -3350,6 +3350,8 @@ static void
url_join_only (server *serv, char *tbuf, char *channel) url_join_only (server *serv, char *tbuf, char *channel)
{ {
/* already connected, JOIN only. FIXME: support keys? */ /* already connected, JOIN only. FIXME: support keys? */
if (channel == NULL)
return;
tbuf[0] = '#'; tbuf[0] = '#';
/* tbuf is 4kb */ /* tbuf is 4kb */
safe_strcpy ((tbuf + 1), channel, 256); safe_strcpy ((tbuf + 1), channel, 256);

View File

@ -1678,6 +1678,7 @@ xit:
#endif #endif
return 0; return 0;
/* cppcheck-suppress memleak */
} }
static void static void

View File

@ -1319,8 +1319,17 @@ int my_poptParseArgvString(const char * s, int * argcPtr, char *** argvPtr) {
if (*argv[argc]) { if (*argv[argc]) {
buf++, argc++; buf++, argc++;
if (argc == argvAlloced) { if (argc == argvAlloced) {
char **temp;
argvAlloced += POPT_ARGV_ARRAY_GROW_DELTA; 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; argv[argc] = buf;
} }

View File

@ -1153,6 +1153,7 @@ key_load_kbs (char *filename)
get_xdir ()); get_xdir ());
fe_message (ibuf, FE_MSG_ERROR); fe_message (ibuf, FE_MSG_ERROR);
free (ibuf); free (ibuf);
free (kb);
return 5; return 5;
} }

View File

@ -1646,7 +1646,8 @@ mg_create_tabmenu (session *sess, GdkEventButton *event, chan *ch)
mg_destroy_tab_cb, ch); mg_destroy_tab_cb, ch);
if (sess && tabmenu_list) if (sess && tabmenu_list)
menu_create (menu, tabmenu_list, sess->channel, FALSE); menu_create (menu, tabmenu_list, sess->channel, FALSE);
menu_add_plugin_items (menu, "\x4$TAB", sess->channel); if (sess)
menu_add_plugin_items (menu, "\x4$TAB", sess->channel);
if (event->window) if (event->window)
gtk_menu_set_screen (GTK_MENU (menu), gdk_drawable_get_screen (event->window)); gtk_menu_set_screen (GTK_MENU (menu), gdk_drawable_get_screen (event->window));

View File

@ -116,7 +116,6 @@ fe_new_window (struct session *sess, int focus)
#endif #endif
"\n\n", 0); "\n\n", 0);
fflush (stdout); fflush (stdout);
fflush (stdin);
} }
static int static int
@ -506,6 +505,7 @@ fe_args (int argc, char *argv[])
*sl = 0; *sl = 0;
printf ("%s\\plugins\n", exe); printf ("%s\\plugins\n", exe);
} }
free (exe);
#else #else
printf ("%s\n", HEXCHATLIBDIR"/plugins"); printf ("%s\n", HEXCHATLIBDIR"/plugins");
#endif #endif