[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] tools: Fix a few error-path memory leaks.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1228827199 0 # Node ID f7f8f44b9292a30707bd645739390ef3d0f22232 # Parent c0c113ab0be528f56aec2854c544535a4245853e tools: Fix a few error-path memory leaks. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- tools/python/xen/lowlevel/acm/acm.c | 2 ++ tools/python/xen/lowlevel/flask/flask.c | 1 + tools/python/xen/lowlevel/xc/xc.c | 11 +++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff -r c0c113ab0be5 -r f7f8f44b9292 tools/python/xen/lowlevel/acm/acm.c --- a/tools/python/xen/lowlevel/acm/acm.c Tue Dec 09 12:45:45 2008 +0000 +++ b/tools/python/xen/lowlevel/acm/acm.c Tue Dec 09 12:53:19 2008 +0000 @@ -68,6 +68,8 @@ static void *__getssid(int domid, uint32 goto out2; } else { *buflen = SSID_BUFFER_SIZE; + free(buf); + buf = NULL; goto out2; } out2: diff -r c0c113ab0be5 -r f7f8f44b9292 tools/python/xen/lowlevel/flask/flask.c --- a/tools/python/xen/lowlevel/flask/flask.c Tue Dec 09 12:45:45 2008 +0000 +++ b/tools/python/xen/lowlevel/flask/flask.c Tue Dec 09 12:53:19 2008 +0000 @@ -55,6 +55,7 @@ static PyObject *pyflask_context_to_sid( xc_handle = xc_interface_open(); if (xc_handle < 0) { errno = xc_handle; + free(buf); return PyErr_SetFromErrno(xc_error_obj); } diff -r c0c113ab0be5 -r f7f8f44b9292 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Tue Dec 09 12:45:45 2008 +0000 +++ b/tools/python/xen/lowlevel/xc/xc.c Tue Dec 09 12:53:19 2008 +0000 @@ -678,19 +678,22 @@ static PyObject *pyxc_get_device_group(X if ( rc < 0 ) { - free(sdev_array); - return pyxc_error_to_exception(); + free(sdev_array); + return pyxc_error_to_exception(); } if ( !num_sdevs ) { - free(sdev_array); - return Py_BuildValue("s", ""); + free(sdev_array); + return Py_BuildValue("s", ""); } group_str = calloc(num_sdevs, sizeof(dev_str)); if (group_str == NULL) + { + free(sdev_array); return PyErr_NoMemory(); + } for ( i = 0; i < num_sdevs; i++ ) { _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |