diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-12-09 12:53:19 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-12-09 12:53:19 +0000 |
commit | 6ac1537ba7694c19ca611495863ed081fbe59fa7 (patch) | |
tree | 5a406936f6512a7bdcc34a0396ef57b65717b0cb /tools | |
parent | b90edb337d11a3e599e170b0835fa31d457aafce (diff) | |
download | xen-6ac1537ba7694c19ca611495863ed081fbe59fa7.tar.gz xen-6ac1537ba7694c19ca611495863ed081fbe59fa7.tar.bz2 xen-6ac1537ba7694c19ca611495863ed081fbe59fa7.zip |
tools: Fix a few error-path memory leaks.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/python/xen/lowlevel/acm/acm.c | 2 | ||||
-rw-r--r-- | tools/python/xen/lowlevel/flask/flask.c | 1 | ||||
-rw-r--r-- | tools/python/xen/lowlevel/xc/xc.c | 11 |
3 files changed, 10 insertions, 4 deletions
diff --git a/tools/python/xen/lowlevel/acm/acm.c b/tools/python/xen/lowlevel/acm/acm.c index 662c7f72d4..d426420d70 100644 --- a/tools/python/xen/lowlevel/acm/acm.c +++ b/tools/python/xen/lowlevel/acm/acm.c @@ -68,6 +68,8 @@ static void *__getssid(int domid, uint32_t *buflen) goto out2; } else { *buflen = SSID_BUFFER_SIZE; + free(buf); + buf = NULL; goto out2; } out2: diff --git a/tools/python/xen/lowlevel/flask/flask.c b/tools/python/xen/lowlevel/flask/flask.c index b8387611b7..bf96cf2af6 100644 --- a/tools/python/xen/lowlevel/flask/flask.c +++ b/tools/python/xen/lowlevel/flask/flask.c @@ -55,6 +55,7 @@ static PyObject *pyflask_context_to_sid(PyObject *self, PyObject *args, xc_handle = xc_interface_open(); if (xc_handle < 0) { errno = xc_handle; + free(buf); return PyErr_SetFromErrno(xc_error_obj); } diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 59a16b3ee7..29a81efdb3 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -678,19 +678,22 @@ static PyObject *pyxc_get_device_group(XcObject *self, 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++ ) { |