summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2017-10-25 19:25:20 +0200
committerJeremy Allison <jra@samba.org>2017-10-27 20:33:25 +0200
commite56626e864492831a3dbbca2d4fb8f3281547a90 (patch)
tree73a5c90877e241f7a5cf26578fd3bd04cb8cc760 /source4
parentb012f1589b3e0cb482e14ca76b5d150792d30643 (diff)
downloadsamba-e56626e864492831a3dbbca2d4fb8f3281547a90.tar.gz
s4:pyparam: Fix resource leaks on error
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13101 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/param/pyparam.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c
index 713e608cf1b..f16c2c0b227 100644
--- a/source4/param/pyparam.c
+++ b/source4/param/pyparam.c
@@ -331,6 +331,9 @@ static PyObject *py_lp_dump_a_parameter(PyObject *self, PyObject *args)
if (!ret) {
PyErr_Format(PyExc_RuntimeError, "Parameter %s unknown for section %s", param_name, section_name);
+ if (f != stdout) {
+ fclose(f);
+ }
return NULL;
}
@@ -479,6 +482,9 @@ static PyObject *py_lp_service_dump(PyObject *self, PyObject *args)
if (!PyObject_TypeCheck(py_default_service, &PyLoadparmService)) {
PyErr_SetNone(PyExc_TypeError);
+ if (f != stdout) {
+ fclose(f);
+ }
return NULL;
}