[asterisk-commits] rmudgett: branch 12 r399576 - /branches/12/main/json.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 20 19:16:19 CDT 2013


Author: rmudgett
Date: Fri Sep 20 19:16:18 2013
New Revision: 399576

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399576
Log:
json: Make it obvious that ast_json_unref() is NULL safe.

It looked like the safety check was done after the NULL pointer was used.

Modified:
    branches/12/main/json.c

Modified: branches/12/main/json.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/json.c?view=diff&rev=399576&r1=399575&r2=399576
==============================================================================
--- branches/12/main/json.c (original)
+++ branches/12/main/json.c Fri Sep 20 19:16:18 2013
@@ -213,13 +213,15 @@
 	struct json_mem_list *free_list;
 	struct json_mem *mem;
 
+	if (!json) {
+		return;
+	}
+
 	/* Jansson refcounting is non-atomic; lock it. */
 	{
 		SCOPED_JSON_LOCK(json);
-		if (!json) {
-			return;
-		}
-		json_decref((json_t *)json);
+
+		json_decref((json_t *) json);
 	}
 
 	/* Now free any objects that were ast_json_free()'s while the lock was




More information about the asterisk-commits mailing list