failure without leaking.
Daniel
+Fri Jun 22 12:14:40 CEST 2007 Daniel Veillard <veillard@redhat.com>
+
+ * qemud/driver.c: apply patch from Jim Meyering to handle realloc
+ failure without leaking.
+
Thu Jun 21 16:56:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* docs/virsh.pod: Fixed a few typos and POD directives.
for (;;) {
char data[1024];
int got = read(vm->monitor, data, sizeof(data));
+ char *b;
if (got == 0) {
if (buf)
free(buf);
return -1;
}
- if (!(buf = realloc(buf, size+got+1)))
+ if (!(b = realloc(buf, size+got+1))) {
+ free(buf);
return -1;
+ }
+ buf = b;
memmove(buf+size, data, got);
buf[size+got] = '\0';
size += got;