]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Bug 478716 - cppcheck detects potential leak in VEX/useful/smchash.c
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 8 Nov 2020 07:00:36 +0000 (08:00 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 8 Nov 2020 07:00:36 +0000 (08:00 +0100)
VEX/useful/smchash.c

index b13e5c2c9164452690989f5a8ea20a9fdc7ad53f..eda2cc039440800090cad459ef3190b44eae0133 100644 (file)
@@ -33,12 +33,12 @@ GuestBytes* read_one ( FILE* f )
   UInt i;
   UInt esum, csum;
 
-  GuestBytes* gb = malloc(sizeof(GuestBytes));
-  assert(gb);
-
   if (feof(f)) return NULL;
   assert(!ferror(f));
 
+  GuestBytes* gb = malloc(sizeof(GuestBytes));
+  assert(gb);
+
   r= fscanf(f, "GuestBytes %llx %d  ", &gb->ga, &gb->nbytes);
   if (0) printf("r = %d\n", r);
   assert(r == 2);