|
From: Paul F. <pa...@so...> - 2020-11-08 07:04:13
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=7967aea84b920d304b99fab60a612740854bd877 commit 7967aea84b920d304b99fab60a612740854bd877 Author: Paul Floyd <pj...@wa...> Date: Sun Nov 8 08:00:36 2020 +0100 Bug 478716 - cppcheck detects potential leak in VEX/useful/smchash.c Diff: --- VEX/useful/smchash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VEX/useful/smchash.c b/VEX/useful/smchash.c index b13e5c2c91..eda2cc0394 100644 --- a/VEX/useful/smchash.c +++ b/VEX/useful/smchash.c @@ -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); |