Browse Source

Handle NULL gracefully in json_tokener_free

Similarly to glibc's free, make json_tokener_free(NULL)
a no-op, to simplify cleanup paths.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
pull/879/head
Ján Tomko 11 months ago
parent
commit
828c12b226
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      json_tokener.c

+ 2
- 0
json_tokener.c View File

@@ -182,6 +182,8 @@ struct json_tokener *json_tokener_new(void)

void json_tokener_free(struct json_tokener *tok)
{
if (!tok)
return;
json_tokener_reset(tok);
if (tok->pb)
printbuf_free(tok->pb);


Loading…
Cancel
Save