[ekg2-commit] r3984 - trunk/plugins/gg: trunk/plugins/gg/commands.c

SVN commit svn w toxygen.net
Pon, 7 Kwi 2008, 22:12:42 CEST


Author: wiechu
Date: 2008-04-07 22:12:42 +0200 (Mon, 07 Apr 2008)
New Revision: 3984

Modified:
   trunk/plugins/gg/commands.c
Log:
    You shall not use pointer to not allocated memory.


Modified: trunk/plugins/gg/commands.c
===================================================================
--- trunk/plugins/gg/commands.c	2008-04-07 15:12:24 UTC (rev 3983)
+++ trunk/plugins/gg/commands.c	2008-04-07 20:12:42 UTC (rev 3984)
@@ -917,7 +917,8 @@
  */
 
 static COMMAND(gg_command_unblock) {
-	const char *uid;
+	char *uid;
+	int ret;
 
 	if (!xstrcmp(params[0], "*")) {
 		userlist_t *ul;
@@ -948,15 +949,18 @@
 		return -1;
 	}
 
-	if (gg_blocked_remove(session, uid) == -1) {
+	uid = xstrdup(uid);
+
+	if ( ( ret = gg_blocked_remove(session, uid) ) == -1)
 		printq("error_not_blocked", format_user(session, uid));
-		return -1;
+	else {		
+		printq("blocked_deleted", format_user(session, uid));
+		config_changed = 1;
 	}
-		
-	printq("blocked_deleted", format_user(session, uid));
-	config_changed = 1;
 
-	return 0;
+	xfree(uid);
+
+	return ret;
 }
 
 #ifdef GIF_OCR



Więcej informacji o liście dyskusyjnej ekg2-commit