提交 65d0b191 编写于 作者: D Daniel Veillard

* qemud/driver.c: apply patch from Jim Meyering to handle realloc

  failure without leaking.
Daniel
上级 e8b0f8a2
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册