Skip to content

Commit

Permalink
Fix: Check 'reader' for NULL before trying to unreference it during c…
Browse files Browse the repository at this point in the history
…leanup (#997)
  • Loading branch information
jjnicola committed Dec 13, 2021
1 parent 15f04b4 commit 0e7d2f3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions misc/table_driven_lsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ get_status_of_table_driven_lsc_from_json (const char *scan_id,
int len)
{
JsonParser *parser;
JsonReader *reader;
JsonReader *reader = NULL;

GError *err = NULL;
gchar *ret = NULL;
Expand Down Expand Up @@ -206,7 +206,8 @@ get_status_of_table_driven_lsc_from_json (const char *scan_id,
json_reader_end_member (reader);

cleanup:
g_object_unref (reader);
if (reader)
g_object_unref (reader);
g_object_unref (parser);
if (err != NULL)
{
Expand Down

0 comments on commit 0e7d2f3

Please sign in to comment.