Skip to content

Commit

Permalink
s4:pyparam: Fix resource leaks on error
Browse files Browse the repository at this point in the history
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13101

Signed-off-by: Andreas Schneider <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
  • Loading branch information
cryptomilk authored and jrasamba committed Oct 27, 2017
1 parent b012f15 commit e56626e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source4/param/pyparam.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit e56626e

Please sign in to comment.