]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix two minor complaints by cppcheck. 739/head
authorPeter Pentchev <roam@ringlet.net>
Thu, 7 Jul 2016 15:22:04 +0000 (18:22 +0300)
committerPeter Pentchev <roam@ringlet.net>
Thu, 7 Jul 2016 15:32:08 +0000 (18:32 +0300)
libarchive/archive_ppmd7_private.h
libarchive/test/test_fuzz.c

index 3a6b9eb4190f79f0e35668d6a9fd08403514eec9..06c99e828ab60a25d301db643d564b39c7369729 100644 (file)
@@ -19,7 +19,7 @@ If you need the compatibility with original PPMd var.H, you can use external Ran
 #define PPMD7_MAX_ORDER 64
 
 #define PPMD7_MIN_MEM_SIZE (1 << 11)
-#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFF - 12 * 3)
+#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFFu - 12 * 3)
 
 struct CPpmd7_Context_;
 
index 76fda6282fa6932aa96e065c7abae73f72fc2e4c..602b894661cced4639ae01182c5219289816c177 100644 (file)
@@ -110,13 +110,17 @@ test_fuzz(const struct files *filesets)
                        for (i = 0; filesets[n].names[i] != NULL; ++i)
                        {
                                tmp = slurpfile(&size, filesets[n].names[i]);
-                               rawimage = (char *)realloc(rawimage, oldsize + size);
+                               char *newraw = (char *)realloc(rawimage, oldsize + size);
+                               if (!assert(newraw != NULL))
+                               {
+                                       free(rawimage);
+                                       continue;
+                               }
+                               rawimage = newraw;
                                memcpy(rawimage + oldsize, tmp, size);
                                oldsize += size;
                                size = oldsize;
                                free(tmp);
-                               if (!assert(rawimage != NULL))
-                                       continue;
                        }
                }
                if (size == 0)