]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Avoid code analyzer error.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sun, 5 Oct 2014 01:37:49 +0000 (10:37 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sun, 5 Oct 2014 01:37:49 +0000 (10:37 +0900)
libarchive/archive_write_set_format_iso9660.c

index 591370298d517890d76e9f7c885699c7804fe046..016f60f4d9688aa982a3d1c3cef503ea3e5d95ff 100644 (file)
@@ -2719,6 +2719,16 @@ extra_get_record(struct isoent *isoent, int *space, int *off, int *loc)
                        rec->offset = 0;
                        /* Insert `rec` into the tail of isoent->extr_rec_list */
                        rec->next = NULL;
+                       /*
+                        * Note: testing isoent->extr_rec_list.last == NULL
+                        * here is really unneeded since it has been already
+                        * initialized at isoent_new function but Clang Static
+                        * Analyzer claims that it is dereference of null
+                        * pointer.
+                        */
+                       if (isoent->extr_rec_list.last == NULL)
+                               isoent->extr_rec_list.last =
+                                       &(isoent->extr_rec_list.first);
                        *isoent->extr_rec_list.last = rec;
                        isoent->extr_rec_list.last = &(rec->next);
                }