diff --git a/tools/read-file.c b/tools/read-file.c index ee35a935..5b7919cd 100644 --- a/tools/read-file.c +++ b/tools/read-file.c @@ -123,10 +123,9 @@ char *read_file(const char *path, size_t *length) if (buf) { save_errno = errno; free(buf); + buf = NULL; } - errno = save_errno; - return NULL; } - + errno = save_errno; return buf; }