From: W.C.A. Wijngaards Date: Thu, 8 Aug 2013 12:36:05 +0000 (+0200) Subject: * Fix memory leak in contrib/python: ldns_pkt.new_query. X-Git-Tag: release-1.6.17rc1~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c640088c180675d07b54cc3bf17ac4769a88dbeb;p=thirdparty%2Fldns.git * Fix memory leak in contrib/python: ldns_pkt.new_query. --- diff --git a/Changelog b/Changelog index b07a489c..94db4c34 100644 --- a/Changelog +++ b/Changelog @@ -30,6 +30,7 @@ dictionary. Patch from shussain. * bugfix #517: ldns_resolver_new_frm_fp error when invoked using a NULL file pointer. + * Fix memory leak in contrib/python: ldns_pkt.new_query. 1.6.16 2012-11-13 * Fix Makefile to build pyldns with BSD make diff --git a/contrib/python/ldns_packet.i b/contrib/python/ldns_packet.i index 9316479f..03f77c0c 100644 --- a/contrib/python/ldns_packet.i +++ b/contrib/python/ldns_packet.i @@ -109,6 +109,18 @@ ldns_rr_list* _ldns_pkt_question(ldns_pkt* p) { /* clone data when pushed in */ +%newobject _ldns_pkt_query_new; +%rename (__ldns_pkt_query_new) ldns_pkt_query_new; +%inline +%{ + ldns_pkt * _ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, + ldns_rr_class rr_class, uint16_t flags) + { + return ldns_pkt_query_new(ldns_rdf_clone(rr_name), rr_type, rr_class, + flags); + } +%} + %rename(__ldns_pkt_push_rr) ldns_pkt_push_rr; %inline %{ bool _ldns_pkt_push_rr(ldns_pkt* p, ldns_pkt_section sec, ldns_rr *rr) { @@ -170,7 +182,7 @@ This simple example instances a resolver in order to resolve NS for nic.cz. :param flags: packet flags :returns: new ldns_pkt object """ - return _ldns.ldns_pkt_query_new(rr_name, rr_type, rr_class, flags) + return _ldns._ldns_pkt_query_new(rr_name, rr_type, rr_class, flags) @staticmethod def new_query_frm_str(rr_name, rr_type, rr_class, flags, raiseException = True):