Index: client/utils.c =================================================================== --- client/utils.c (revision 1257) +++ client/utils.c (working copy) @@ -30,6 +30,7 @@ #include #include #include +#include #include @@ -70,14 +71,19 @@ if (!strcmp("preferences", name)) { while (atts[i]) { if (!strcmp("nick", atts[i])) { + free(prefs->nick); prefs->nick = strdup(atts[i+1]); } else if (!strcmp("url", atts[i])) { + free(prefs->url); prefs->url = strdup(atts[i+1]); } else if (!strcmp("password", atts[i])) { + free(prefs->password); prefs->password = strdup(atts[i+1]); } else if (!strcmp("video_driver", atts[i])) { + free(prefs->video_driver); prefs->video_driver = strdup(atts[i+1]); } else if (!strcmp("uid", atts[i])) { + free(prefs->uid); prefs->uid = strdup(atts[i+1]); } else if (!strcmp("cache", atts[i])) { prefs->cache_size = atoi(atts[i+1]); @@ -168,7 +174,7 @@ /* 64 random bits encoded as ascii */ void make_uniqueid(prefs_t *prefs) { static char *rdevice = "/dev/urandom"; - unsigned long d[2]; + uint32_t d[2]; int rfd; struct timeval tv; char ub[17]; @@ -190,15 +196,20 @@ d[0] ^= tv.tv_sec; d[1] ^= tv.tv_usec; snprintf(ub, 17, "%08lX%08lX", d[0], d[1]); + free(prefs->uid); prefs->uid = strdup(ub); } void default_rc(prefs_t *prefs) { - prefs->nick = ""; - prefs->url = ""; - prefs->password = ""; + free(prefs->nick); + prefs->nick = strdup(""); + free(prefs->url); + prefs->url = strdup(""); + free(prefs->password); + prefs->password = strdup(""); prefs->cache_size = 2000; - prefs->video_driver = ""; + free(prefs->video_driver); + prefs->video_driver = strdup(""); make_uniqueid(prefs); prefs->frame_rate = 23.0; prefs->nrepeats = 2; Index: client/electricsheep.c =================================================================== --- client/electricsheep.c (revision 1257) +++ client/electricsheep.c (working copy) @@ -735,6 +735,7 @@ exit(1); } av_free_packet(&opkt); + av_free_packet(&ipkt); } av_close_input_file(ictx); } Index: client/electricsheep-preferences.c =================================================================== --- client/electricsheep-preferences.c (revision 1257) +++ client/electricsheep-preferences.c (working copy) @@ -52,11 +52,16 @@ GtkButton *test_button; void clear_prefs(prefs_t *prefs) { + free(prefs->nick); prefs->nick = NULL; + free(prefs->url); prefs->url = NULL; + free(prefs->password); prefs->password = NULL; + free(prefs->video_driver); prefs->video_driver = NULL; prefs->cache_size = -1; + free(prefs->uid); prefs->uid = NULL; prefs->frame_rate = -1.0; prefs->play_evenly = 1.0;