<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19477">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">func_json: Fix memory leak.<br><br>A memory leak was present in func_json due to<br>using ast_json_free, which just calls ast_free,<br>as opposed to recursively freeing the JSON<br>object as needed. This is now fixed to use the<br>right free functions.<br><br>ASTERISK-30293 #close<br><br>Change-Id: I982324dde841dc9147c8d8ad35c8719daf418b49<br>---<br>M funcs/func_json.c<br>1 file changed, 19 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/77/19477/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/funcs/func_json.c b/funcs/func_json.c</span><br><span>index 1f64824..55a0343 100644</span><br><span>--- a/funcs/func_json.c</span><br><span>+++ b/funcs/func_json.c</span><br><span>@@ -115,7 +115,7 @@</span><br><span>        jsonval = ast_json_object_get(json, args.key);</span><br><span>       if (!jsonval) { /* no error or warning should be thrown */</span><br><span>           ast_debug(1, "Could not find key '%s' in parsed JSON\n", args.key);</span><br><span style="color: hsl(0, 100%, 40%);">-           ast_json_free(json);</span><br><span style="color: hsl(120, 100%, 40%);">+          ast_json_unref(json);</span><br><span>                return -1;</span><br><span>   }</span><br><span>    switch(ast_json_typeof(jsonval)) {</span><br><span>@@ -134,7 +134,7 @@</span><br><span>                     ast_json_free(result2);</span><br><span>                      break;</span><br><span>       }</span><br><span style="color: hsl(0, 100%, 40%);">-       ast_json_free(json);</span><br><span style="color: hsl(120, 100%, 40%);">+  ast_json_unref(json);</span><br><span> </span><br><span>    return 0;</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19477">change 19477</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/19477"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I982324dde841dc9147c8d8ad35c8719daf418b49 </div>
<div style="display:none"> Gerrit-Change-Number: 19477 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>