mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
uml_driver.c: avoid leak upon failure
* src/uml/uml_driver.c (umlMonitorCommand): This function would sometimes return -1, yet fail to free the "reply" it had allocated. Hence, no caller would know to free the corresponding argument. When returning -1, be sure to free all allocated resources.
This commit is contained in:
parent
4a3d1ca3f1
commit
59467601c2
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* uml_driver.c: core driver methods for managing UML guests
|
* uml_driver.c: core driver methods for managing UML guests
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc.
|
* Copyright (C) 2006-2010 Red Hat, Inc.
|
||||||
* Copyright (C) 2006-2008 Daniel P. Berrange
|
* Copyright (C) 2006-2008 Daniel P. Berrange
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -757,7 +757,10 @@ static int umlMonitorCommand(virConnectPtr conn,
|
|||||||
|
|
||||||
VIR_DEBUG("Command reply is '%s'", NULLSTR(retdata));
|
VIR_DEBUG("Command reply is '%s'", NULLSTR(retdata));
|
||||||
|
|
||||||
*reply = retdata;
|
if (ret < 0)
|
||||||
|
VIR_FREE(retdata);
|
||||||
|
else
|
||||||
|
*reply = retdata;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user