diff options
author | Tomas Popela <tpopela@redhat.com> | 2018-07-23 10:09:43 +0200 |
---|---|---|
committer | David King <amigadave@amigadave.com> | 2019-01-21 14:38:59 +0000 |
commit | 45292455a213671d2345fc15a87bb4810f0d43c8 (patch) | |
tree | 951de18ebf80295db20d31c9b24297fdd3a529ca | |
parent | e7f03bfb6e28ebadc1bf5c5b615ad0f90e0e2bb3 (diff) | |
download | yelp-45292455a213671d2345fc15a87bb4810f0d43c8.tar.gz |
Check whether the index variable is valid before dereferencing it
yelp-3.28.1/libyelp/yelp-docbook-document.c:1058: check_after_deref: Null-checking "index" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
yelp-3.28.1/libyelp/yelp-docbook-document.c:1026: deref_ptr: Directly dereferencing pointer "index".
yelp-3.28.1/libyelp/yelp-docbook-document.c:1054: deref_ptr: Directly dereferencing pointer "index".
1052| if (filename != NULL)
1053| g_free (filename);
1054|-> if (index->doc != NULL)
1055| xmlFreeDoc (index->doc);
1056| if (index->doc_uri != NULL)
-rw-r--r-- | libyelp/yelp-docbook-document.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libyelp/yelp-docbook-document.c b/libyelp/yelp-docbook-document.c index 9557427f..62f40611 100644 --- a/libyelp/yelp-docbook-document.c +++ b/libyelp/yelp-docbook-document.c @@ -1129,12 +1129,13 @@ docbook_index_threaded (YelpDocbookDocument *docbook) g_object_unref (file); if (filename != NULL) g_free (filename); - if (index->doc != NULL) - xmlFreeDoc (index->doc); - if (index->doc_uri != NULL) - g_free (index->doc_uri); - if (index != NULL) + if (index != NULL) { + if (index->doc != NULL) + xmlFreeDoc (index->doc); + if (index->doc_uri != NULL) + g_free (index->doc_uri); g_free (index); + } if (parserCtxt != NULL) xmlFreeParserCtxt (parserCtxt); |