[mw-devel] MW3 r1309 - trunk/src/server

welshbyte at sucs.org welshbyte at sucs.org
Fri Nov 30 22:37:40 GMT 2012


Author: welshbyte
Date: 2012-11-30 22:37:39 +0000 (Fri, 30 Nov 2012)
New Revision: 1309

Modified:
   trunk/src/server/servsock.c
Log:
Fix two leaks in the server's uptime code


Modified: trunk/src/server/servsock.c
===================================================================
--- trunk/src/server/servsock.c	2012-11-30 18:53:46 UTC (rev 1308)
+++ trunk/src/server/servsock.c	2012-11-30 22:37:39 UTC (rev 1309)
@@ -15,6 +15,7 @@
 #include "servsock.h"
 #include "../files.h"
 #include "../nonce.h"
+#include "../util.h"
 
 struct list_head connection_list;
 
@@ -258,12 +259,13 @@
 
 		json_t * j = json_init(NULL);
 		json_addint(j, "uptime", now - uptime);
-		char *version = NULL;
+		AUTOFREE_BUFFER version = NULL;
 		asprintf(&version, "%s.%s.%s", VER_MAJ, VER_MIN, VER_TWK);
 		json_addstring(j, "version", version);
 		ipcmsg_json_encode(msg, j);
 		msg_attach(msg, conn);
 		ipcmsg_destroy(msg);
+		json_decref(j);
 		return;
 	}
 




More information about the mw-devel mailing list