mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-25 07:01:09 +00:00
func_json: Fix memory leak.
A memory leak was present in func_json due to using ast_json_free, which just calls ast_free, as opposed to recursively freeing the JSON object as needed. This is now fixed to use the right free functions. ASTERISK-30293 #close Change-Id: I982324dde841dc9147c8d8ad35c8719daf418b49
This commit is contained in:
committed by
George Joseph
parent
d5c8f60a72
commit
cb1d31bc3e
@@ -115,7 +115,7 @@ static int json_decode_read(struct ast_channel *chan, const char *cmd, char *dat
|
|||||||
jsonval = ast_json_object_get(json, args.key);
|
jsonval = ast_json_object_get(json, args.key);
|
||||||
if (!jsonval) { /* no error or warning should be thrown */
|
if (!jsonval) { /* no error or warning should be thrown */
|
||||||
ast_debug(1, "Could not find key '%s' in parsed JSON\n", args.key);
|
ast_debug(1, "Could not find key '%s' in parsed JSON\n", args.key);
|
||||||
ast_json_free(json);
|
ast_json_unref(json);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
switch(ast_json_typeof(jsonval)) {
|
switch(ast_json_typeof(jsonval)) {
|
||||||
@@ -134,7 +134,7 @@ static int json_decode_read(struct ast_channel *chan, const char *cmd, char *dat
|
|||||||
ast_json_free(result2);
|
ast_json_free(result2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ast_json_free(json);
|
ast_json_unref(json);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user