summaryrefslogtreecommitdiffstats
path: root/test/ipedec.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2012-04-17 15:45:54 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2012-04-17 15:45:54 +0200
commit519ec3e652952530f975482b56ead02b03c1e28a (patch)
treec91eaad8bceecb4c742bdeb498dd308050e3d3b6 /test/ipedec.c
parent61a8170862fa8cc3688e0347ded09446489f365c (diff)
downloadlibufodecode-519ec3e652952530f975482b56ead02b03c1e28a.tar.gz
libufodecode-519ec3e652952530f975482b56ead02b03c1e28a.tar.bz2
libufodecode-519ec3e652952530f975482b56ead02b03c1e28a.tar.xz
libufodecode-519ec3e652952530f975482b56ead02b03c1e28a.zip
Fix wrong free
Diffstat (limited to 'test/ipedec.c')
-rw-r--r--test/ipedec.c3
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;