mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +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>
|
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.
|
* docs/virsh.pod: Fixed a few typos and POD directives.
|
||||||
|
@ -75,6 +75,7 @@ int qemudMonitorCommand(struct qemud_server *server ATTRIBUTE_UNUSED,
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
char data[1024];
|
char data[1024];
|
||||||
int got = read(vm->monitor, data, sizeof(data));
|
int got = read(vm->monitor, data, sizeof(data));
|
||||||
|
char *b;
|
||||||
|
|
||||||
if (got == 0) {
|
if (got == 0) {
|
||||||
if (buf)
|
if (buf)
|
||||||
@ -91,8 +92,11 @@ int qemudMonitorCommand(struct qemud_server *server ATTRIBUTE_UNUSED,
|
|||||||
free(buf);
|
free(buf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!(buf = realloc(buf, size+got+1)))
|
if (!(b = realloc(buf, size+got+1))) {
|
||||||
|
free(buf);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
buf = b;
|
||||||
memmove(buf+size, data, got);
|
memmove(buf+size, data, got);
|
||||||
buf[size+got] = '\0';
|
buf[size+got] = '\0';
|
||||||
size += got;
|
size += got;
|
||||||
|
Loading…
Reference in New Issue
Block a user