mirror of
https://github.com/SELinuxProject/selinux
synced 2025-04-23 07:45:19 +00:00
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@m4x.org>
25 lines
555 B
Bash
Executable File
25 lines
555 B
Bash
Executable File
function except() {
|
|
case $1 in
|
|
selinux_file_context_cmp) # ignore
|
|
;;
|
|
*)
|
|
echo "
|
|
%exception $1 {
|
|
\$action
|
|
if (result < 0) {
|
|
PyErr_SetFromErrno(PyExc_OSError);
|
|
SWIG_fail;
|
|
}
|
|
}
|
|
"
|
|
;;
|
|
esac
|
|
}
|
|
if ! ${CC:-gcc} -x c -c -I../include - -aux-info temp.aux < ../include/selinux/selinux.h
|
|
then
|
|
# clang does not support -aux-info so fall back to gcc
|
|
gcc -x c -c -I../include - -aux-info temp.aux < ../include/selinux/selinux.h
|
|
fi
|
|
for i in `awk '/<stdin>.*extern int/ { print $6 }' temp.aux`; do except $i ; done
|
|
rm -f -- temp.aux -.o
|