diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2012-04-17 15:45:54 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2012-04-17 15:45:54 +0200 |
commit | 519ec3e652952530f975482b56ead02b03c1e28a (patch) | |
tree | c91eaad8bceecb4c742bdeb498dd308050e3d3b6 | |
parent | 61a8170862fa8cc3688e0347ded09446489f365c (diff) | |
download | ufodecode-519ec3e652952530f975482b56ead02b03c1e28a.tar.gz ufodecode-519ec3e652952530f975482b56ead02b03c1e28a.tar.bz2 ufodecode-519ec3e652952530f975482b56ead02b03c1e28a.tar.xz ufodecode-519ec3e652952530f975482b56ead02b03c1e28a.zip |
Fix wrong free
-rw-r--r-- | test/ipedec.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/ipedec.c b/test/ipedec.c index f429ce6..43e4641 100644 --- a/test/ipedec.c +++ b/test/ipedec.c @@ -20,6 +20,7 @@ static int read_raw_file(const char *filename, char **buffer, size_t *length) rewind(fp); *buffer = (char *) malloc(*length); + if (*buffer == NULL) { fclose(fp); return ENOMEM; @@ -28,7 +29,7 @@ static int read_raw_file(const char *filename, char **buffer, size_t *length) size_t buffer_length = fread(*buffer, 1, *length, fp); fclose(fp); if (buffer_length != *length) { - free(buffer); + free(*buffer); return ERANGE; } return 0; |