[asterisk-commits] rmudgett: trunk r399578 - in /trunk: ./ main/json.c

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


Author: rmudgett
Date: Fri Sep 20 19:17:56 2013
New Revision: 399578

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399578
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.
........

Merged revisions 399576 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/json.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Fri Sep 20 19:17:56 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399100,399136,399146,399160,399197,399207,399225,399237,399247,399257,399268,399283,399294,399339,399365,399376,399404,399458,399501,399514,399531,399553,399565
+/branches/12:1-398558,398560-398577,398579-399100,399136,399146,399160,399197,399207,399225,399237,399247,399257,399268,399283,399294,399339,399365,399376,399404,399458,399501,399514,399531,399553,399565,399576

Modified: trunk/main/json.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/json.c?view=diff&rev=399578&r1=399577&r2=399578
==============================================================================
--- trunk/main/json.c (original)
+++ trunk/main/json.c Fri Sep 20 19:17:56 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