changeset 16261:f1c2ff731fd9

Fix use before initialization and use after freeing (This is still not being used, but I figured I'd fix the stuff that I noticed).
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 19 Apr 2007 13:32:48 +0000
parents d465bbc0f759
children 9815ba2af570
files libpurple/prefs.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/prefs.c	Thu Apr 19 01:51:32 2007 +0000
+++ b/libpurple/prefs.c	Thu Apr 19 13:32:48 2007 +0000
@@ -1116,17 +1116,19 @@
 		}
 	}
 
+	oldname = pref_full_name(oldpref);
+	newname = pref_full_name(newpref);
+
 	if (oldpref->type != newpref->type)
 	{
 		purple_debug_error("prefs", "Unable to rename %s to %s: differing types\n", oldname, newname);
+		g_free(oldname);
+		g_free(newname);
 		return;
 	}
 
-	oldname = pref_full_name(oldpref);
-	newname = pref_full_name(newpref);
 	purple_debug_info("prefs", "Renaming %s to %s\n", oldname, newname);
 	g_free(oldname);
-	g_free(newname);
 
 	switch(oldpref->type) {
 		case PURPLE_PREF_NONE:
@@ -1150,6 +1152,7 @@
 			purple_prefs_set_path_list(newname, oldpref->value.stringlist);
 			break;
 	}
+	g_free(newname);
 
 	remove_pref(oldpref);
 }