From 0984fac73f335a22b46e1b02fac03e99c428275a Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Wed, 12 Sep 2012 00:23:18 +0000 Subject: Get reference counts right. svn path=/branches/tk274/; revision=4709 --- rpkid/ext/POW.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'rpkid/ext/POW.c') diff --git a/rpkid/ext/POW.c b/rpkid/ext/POW.c index 84571324..67bd5bae 100644 --- a/rpkid/ext/POW.c +++ b/rpkid/ext/POW.c @@ -1583,26 +1583,17 @@ x509_object_get_rfc3779(x509_object *self) } } - if (asn_result == NULL) { - Py_INCREF(Py_None); - asn_result = Py_None; - } - - if (ipv4_result == NULL) { - Py_INCREF(Py_None); - ipv4_result = Py_None; - } - - if (ipv6_result == NULL) { - Py_INCREF(Py_None); - ipv6_result = Py_None; - } - - result = Py_BuildValue("(OOO)", asn_result, ipv4_result, ipv6_result); + result = Py_BuildValue("(OOO)", + (asn_result == NULL ? Py_None : asn_result), + (ipv4_result == NULL ? Py_None : ipv4_result), + (ipv6_result == NULL ? Py_None : ipv6_result)); error: /* Fall through */ ASIdentifiers_free(asid); sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free); + Py_XDECREF(range_b); + Py_XDECREF(range_e); + Py_XDECREF(range); Py_XDECREF(asn_result); Py_XDECREF(ipv4_result); Py_XDECREF(ipv6_result); -- cgit v1.2.3