Projet

Général

Profil

0021-python-do-not-leak-out_pyvalue-if-method-call-protoc.patch

Benjamin Dauvergne, 20 juin 2020 12:44

Télécharger (1,31 ko)

Voir les différences:

Subject: [PATCH 21/21] python: do not leak out_pyvalue if method call protocol
 is not respected (#44287)

 bindings/python/lang.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
bindings/python/lang.py
1039 1039
        for f, arg in zip(parse_tuple_format, m.args):
1040 1040
            if is_out(arg):
1041 1041
                self.return_value(fd, arg, return_var_name = arg[1], return_pyvar_name = 'out_pyvalue')
1042
                print_('    PyList_SetItem(cvt_%s_out, 0, out_pyvalue);' % arg[1], file=fd)
1042

  
1043
                print_('    EXIT_IF_FAIL(%s);' % arg[1], file=fd)
1044
                print_('    if (PyList_SetItem(cvt_%s_out, 0, out_pyvalue) == -1) {' % arg[1], file=fd)
1045
                print_('        ok = 0;', file=fd)
1046
                print_('        Py_XDECREF(out_pyvalue);', file=fd)
1047
                print_('    }', file=fd)
1043 1048
            elif arg[0] == 'GList*':
1044 1049
                qualifier = arg[2].get('element-type')
1045 1050
                if is_cstring(qualifier):
1046
-