Re: [PATCH 2/2] libselinux, libsemanage: swig: use SWIG_fail when an error occurs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/14/2016 04:57 PM, Nicolas Iooss wrote:
> 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>

Thanks, applied both patches.

> ---
>  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;
>    }
>  }
>  "
> 

_______________________________________________
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.



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux