mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
fix python memory leak.
git-svn-id: file:///svn/unbound/trunk@1818 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
ca9c1fa2a8
commit
18e9cbb39f
3 changed files with 17 additions and 10 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
- do not call sphinx for documentation when python is disabled.
|
- do not call sphinx for documentation when python is disabled.
|
||||||
- remove EV_PERSIST from libevent timeout code to make the code
|
- remove EV_PERSIST from libevent timeout code to make the code
|
||||||
compatible with the libevent-2.0. Works with older libevent too.
|
compatible with the libevent-2.0. Works with older libevent too.
|
||||||
|
- fix memory leak in python code.
|
||||||
|
|
||||||
3 September 2009: Wouter
|
3 September 2009: Wouter
|
||||||
- Got a patch from Luca Bruno for libunbound support on windows to
|
- Got a patch from Luca Bruno for libunbound support on windows to
|
||||||
|
|
|
||||||
|
|
@ -779,7 +779,7 @@ int set_return_msg(struct module_qstate* qstate,
|
||||||
{
|
{
|
||||||
ldns_pkt* pkt = 0;
|
ldns_pkt* pkt = 0;
|
||||||
ldns_status status;
|
ldns_status status;
|
||||||
ldns_rr_list* rr_list1 = 0,*rr_list2 = 0,*rr_list3 = 0,*rr_list4 = 0;
|
ldns_rr_list* rr_list = 0;
|
||||||
ldns_buffer *qb = 0;
|
ldns_buffer *qb = 0;
|
||||||
int res = 1;
|
int res = 1;
|
||||||
|
|
||||||
|
|
@ -790,14 +790,18 @@ int set_return_msg(struct module_qstate* qstate,
|
||||||
if ((status != LDNS_STATUS_OK) || (pkt == 0))
|
if ((status != LDNS_STATUS_OK) || (pkt == 0))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
rr_list1 = createRRList(question, default_ttl);
|
rr_list = createRRList(question, default_ttl);
|
||||||
if ((rr_list1) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_QUESTION, rr_list1);
|
if ((rr_list) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_QUESTION, rr_list);
|
||||||
rr_list2 = createRRList(answer, default_ttl);
|
ldns_rr_list_free(rr_list);
|
||||||
if ((rr_list2) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_ANSWER, rr_list2);
|
rr_list = createRRList(answer, default_ttl);
|
||||||
rr_list3 = createRRList(authority, default_ttl);
|
if ((rr_list) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_ANSWER, rr_list);
|
||||||
if ((rr_list3) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_AUTHORITY, rr_list3);
|
ldns_rr_list_free(rr_list);
|
||||||
rr_list4 = createRRList(additional, default_ttl);
|
rr_list = createRRList(authority, default_ttl);
|
||||||
if ((rr_list4) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_ADDITIONAL, rr_list4);
|
if ((rr_list) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_AUTHORITY, rr_list);
|
||||||
|
ldns_rr_list_free(rr_list);
|
||||||
|
rr_list = createRRList(additional, default_ttl);
|
||||||
|
if ((rr_list) && (res)) res = ldns_pkt_push_rr_list(pkt, LDNS_SECTION_ADDITIONAL, rr_list);
|
||||||
|
ldns_rr_list_free(rr_list);
|
||||||
|
|
||||||
if ((res) && ((qb = ldns_buffer_new(LDNS_MIN_BUFLEN)) == 0)) res = 0;
|
if ((res) && ((qb = ldns_buffer_new(LDNS_MIN_BUFLEN)) == 0)) res = 0;
|
||||||
if ((res) && (ldns_pkt2buffer_wire(qb, pkt) != LDNS_STATUS_OK)) res = 0;
|
if ((res) && (ldns_pkt2buffer_wire(qb, pkt) != LDNS_STATUS_OK)) res = 0;
|
||||||
|
|
@ -806,7 +810,7 @@ int set_return_msg(struct module_qstate* qstate,
|
||||||
|
|
||||||
if (qb) ldns_buffer_free(qb);
|
if (qb) ldns_buffer_free(qb);
|
||||||
|
|
||||||
ldns_pkt_free(pkt); //this function dealocates pkt as well as rr_lists
|
ldns_pkt_free(pkt); //this function dealocates pkt as well as rrs
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
|
|
@ -245,6 +245,8 @@ void pythonmod_deinit(struct module_env* env, int id)
|
||||||
|
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
}
|
}
|
||||||
|
pe->fname = NULL;
|
||||||
|
free(pe);
|
||||||
|
|
||||||
/* Module is deallocated in Python */
|
/* Module is deallocated in Python */
|
||||||
env->modinfo[id] = NULL;
|
env->modinfo[id] = NULL;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue