]> granicus.if.org Git - zziplib/commitdiff
fseeko.c: fix possible double free of buffer
authorJakub Martisko <imartisko@fit.vutbr.cz>
Thu, 22 Nov 2018 09:44:47 +0000 (10:44 +0100)
committerJakub Martisko <imartisko@fit.vutbr.cz>
Thu, 22 Nov 2018 09:44:47 +0000 (10:44 +0100)
zzip/fseeko.c

index 337949276061cca2c85a3a3f3881062c08bc774e..635bf57b8d4f3c6abe6c6a387b6e0b9d4d6acad0 100644 (file)
@@ -418,6 +418,7 @@ zzip_entry_findfirst(FILE * disk)
             if (zzip_disk_entry_check_magic(entry))
             {
                 free(buffer);
+                buffer = NULL;
                 entry->headseek = root;
                 entry->diskfile = disk;
                 entry->disksize = disksize;
@@ -448,7 +449,8 @@ zzip_entry_findfirst(FILE * disk)
     }
     errno = ENOENT; /* not found */
   error2:
-    free(buffer);
+    if (buffer != NULL)
+       free(buffer);
   error1:
     free(entry);
     ____;