summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-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;