From 519ec3e652952530f975482b56ead02b03c1e28a Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Tue, 17 Apr 2012 15:45:54 +0200 Subject: Fix wrong free --- test/ipedec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/ipedec.c') 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; -- cgit v1.2.3