summaryrefslogtreecommitdiff
path: root/source4/scripting/python/pyxattr_native.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting/python/pyxattr_native.c')
-rw-r--r--source4/scripting/python/pyxattr_native.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source4/scripting/python/pyxattr_native.c b/source4/scripting/python/pyxattr_native.c
index 70fdf571f1..9b60039a38 100644
--- a/source4/scripting/python/pyxattr_native.c
+++ b/source4/scripting/python/pyxattr_native.c
@@ -35,6 +35,7 @@ static PyObject *py_is_xattr_supported(PyObject *self)
return Py_True;
#endif
}
+
static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args)
{
char *filename, *attribute;
@@ -42,11 +43,12 @@ static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args)
int blobsize;
DATA_BLOB blob;
- if (!PyArg_ParseTuple(args, "sss#", &filename,&attribute,&blob.data,&blobsize))
+ if (!PyArg_ParseTuple(args, "sss#", &filename, &attribute, &blob.data,
+ &blobsize))
return NULL;
blob.length = blobsize;
- ret = wrap_setxattr(filename,attribute,blob.data,blob.length,0);
+ ret = wrap_setxattr(filename, attribute, blob.data, blob.length, 0);
if( ret < 0 ) {
if (errno == ENOTSUP) {
PyErr_SetFromErrno(PyExc_IOError);
@@ -65,7 +67,7 @@ static PyObject *py_wrap_getxattr(PyObject *self, PyObject *args)
TALLOC_CTX *mem_ctx;
char *buf;
PyObject *ret;
- if (!PyArg_ParseTuple(args, "ss", &filename,&attribute))
+ if (!PyArg_ParseTuple(args, "ss", &filename, &attribute))
return NULL;
mem_ctx = talloc_new(NULL);
len = wrap_getxattr(filename,attribute,NULL,0);
@@ -75,6 +77,7 @@ static PyObject *py_wrap_getxattr(PyObject *self, PyObject *args)
} else {
PyErr_SetFromErrno(PyExc_TypeError);
}
+ talloc_free(mem_ctx);
return NULL;
}
/* check length ... */
@@ -86,10 +89,11 @@ static PyObject *py_wrap_getxattr(PyObject *self, PyObject *args)
} else {
PyErr_SetFromErrno(PyExc_TypeError);
}
+ talloc_free(mem_ctx);
return NULL;
}
ret = PyString_FromStringAndSize(buf, len);
- talloc_free(buf);
+ talloc_free(mem_ctx);
return ret;
}