pyldb: Properly increase refcount of returned values
authorPetr Viktorin <pviktori@redhat.com>
Thu, 11 Jun 2015 08:16:48 +0000 (10:16 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 5 Nov 2015 17:04:24 +0000 (18:04 +0100)
Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/ldb/pyldb.c

index 307f426a7450830b5d89f115466245a16f75fed7..196662583cc33c627c767d073ff80590c6841c17 100644 (file)
@@ -1798,7 +1798,7 @@ static PyObject *py_ldb_get_opaque(PyLdbObject *self, PyObject *args)
 
        /* FIXME: More interpretation */
 
-       return Py_True;
+       Py_RETURN_TRUE;
 }
 
 static PyObject *py_ldb_set_opaque(PyLdbObject *self, PyObject *args)
@@ -2759,6 +2759,7 @@ static PyObject *py_ldb_msg_get(PyLdbMessageObject *self, PyObject *args, PyObje
 
        if (el == NULL || (idx != -1 && el->num_values <= idx)) {
                if (def != NULL) {
+                       Py_INCREF(def);
                        return def;
                }
                Py_RETURN_NONE;