mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
* qemud/driver.c: apply patch from Jim Meyering to handle realloc
failure without leaking. Daniel
This commit is contained in:
parent
e8b0f8a251
commit
65d0b1910b
@ -1,3 +1,8 @@
|
||||
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.
|
||||
|
@ -75,6 +75,7 @@ int qemudMonitorCommand(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
for (;;) {
|
||||
char data[1024];
|
||||
int got = read(vm->monitor, data, sizeof(data));
|
||||
char *b;
|
||||
|
||||
if (got == 0) {
|
||||
if (buf)
|
||||
@ -91,8 +92,11 @@ int qemudMonitorCommand(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user