Fix buffer passed to free()

This commit is contained in:
Daniel P. Berrange 2008-01-08 16:17:15 +00:00
parent 94e49e3f0e
commit 8cd4774468
2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,7 @@
Tue Jan 8 11:12:00 EST 2008 Daniel P. Berrange <berrange@redhat.com>
* src/util.c: Fix addr passed to free() in error cleanup
Mon Jan 7 10:19:00 EST 2008 Daniel P. Berrange <berrange@redhat.com> Mon Jan 7 10:19:00 EST 2008 Daniel P. Berrange <berrange@redhat.com>
* src/util.c, src/util.h: virFileReadAll() now allocates its * src/util.c, src/util.h: virFileReadAll() now allocates its

View File

@ -308,7 +308,7 @@ int virFileReadAll(const char *path,
} }
if ((ret = fread(*buf, st.st_size, 1, fh)) != 1) { if ((ret = fread(*buf, st.st_size, 1, fh)) != 1) {
free(buf); free(*buf);
*buf = NULL; *buf = NULL;
virLog("Failed to read config file '%s': %s", virLog("Failed to read config file '%s': %s",
path, strerror(errno)); path, strerror(errno));