Skip to content

Commit

Permalink
Fix 'Memory leak: rawdata' (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored Oct 5, 2021
1 parent 8176534 commit 063b37e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mdloader_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,14 @@ data_t *load_file(char *fname)
return NULL;
}

data_t * ret = NULL;
if (ftype == FTYPE_HEX)
return parse_hex(rawdata, readbytes);
ret = parse_hex(rawdata, readbytes);
else if (ftype == FTYPE_BIN)
return parse_bin(rawdata, readbytes);
ret = parse_bin(rawdata, readbytes);
else
printf("ERROR: Parser: Unknown file type!\n");

return NULL;
free(rawdata);
return ret;
}

0 comments on commit 063b37e

Please sign in to comment.