Skip to content

Commit 063b37e

Browse files
authored
Fix 'Memory leak: rawdata' (#64)
1 parent 8176534 commit 063b37e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mdloader_parser.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,14 @@ data_t *load_file(char *fname)
386386
return NULL;
387387
}
388388

389+
data_t * ret = NULL;
389390
if (ftype == FTYPE_HEX)
390-
return parse_hex(rawdata, readbytes);
391+
ret = parse_hex(rawdata, readbytes);
391392
else if (ftype == FTYPE_BIN)
392-
return parse_bin(rawdata, readbytes);
393+
ret = parse_bin(rawdata, readbytes);
393394
else
394395
printf("ERROR: Parser: Unknown file type!\n");
395396

396-
return NULL;
397+
free(rawdata);
398+
return ret;
397399
}

0 commit comments

Comments
 (0)