Using SWIG_fail in the Python SWIG wrappers makes the wrapping function destroy/free the memory which could have been dynamically allocated before calling the wrapped function. This thus prevents possible memory leaks in the wrappers of set*con(), set*con_raw(), security_compute_*(), etc. Signed-off-by: Nicolas Iooss <nicolas.iooss@xxxxxxx> --- libselinux/src/exception.sh | 2 +- libsemanage/src/exception.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libselinux/src/exception.sh b/libselinux/src/exception.sh index a3ff83235ced..d6c8c71713ad 100755 --- a/libselinux/src/exception.sh +++ b/libselinux/src/exception.sh @@ -8,7 +8,7 @@ echo " \$action if (result < 0) { PyErr_SetFromErrno(PyExc_OSError); - return NULL; + SWIG_fail; } } " diff --git a/libsemanage/src/exception.sh b/libsemanage/src/exception.sh index a4095f4f8ba6..97bc2ae879f2 100644 --- a/libsemanage/src/exception.sh +++ b/libsemanage/src/exception.sh @@ -4,7 +4,7 @@ echo " \$action if (result < 0) { PyErr_SetFromErrno(PyExc_OSError); - return NULL; + SWIG_fail; } } " -- 2.10.2 _______________________________________________ Selinux mailing list Selinux@xxxxxxxxxxxxx To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx. To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.