Projects
Eulaceura:Mainline:GA
libtasn1
_service:obs_scm:fix-memleaks-in-asn1-arrat2tre...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:fix-memleaks-in-asn1-arrat2tree.patch of Package libtasn1
From ea0e4fc2567edfc0d20141025837e2bd9c64c0cb Mon Sep 17 00:00:00 2001 From: opneErler BUildteam <buildteam@openeuler.org> Date: Fri, 5 Jun 2020 15:46:37 +0800 Subject: [PATCH] fix memleaks in asn1 arrat2tree --- lib/parser_aux.c | 2 +- lib/structure.c | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/parser_aux.c b/lib/parser_aux.c index c05bd23..e5e4cc3 100644 --- a/lib/parser_aux.c +++ b/lib/parser_aux.c @@ -766,7 +766,7 @@ _asn1_expand_object_id (list_type ** list, asn1_node node) return ASN1_ELEMENT_NOT_FOUND; _asn1_set_down (p, p2->right); - if (p2->down) + while (p2->down) _asn1_delete_structure (*list, &p2->down, 0); _asn1_delete_node_from_list (*list, p2); _asn1_remove_node (p2, 0); diff --git a/lib/structure.c b/lib/structure.c index 512dd60..13f02ba 100644 --- a/lib/structure.c +++ b/lib/structure.c @@ -207,13 +207,13 @@ asn1_array2tree (const asn1_static_node * array, asn1_node * definitions, if (move == DOWN) { - if (p_last && p_last->down) + while (p_last && p_last->down) _asn1_delete_structure (e_list, &p_last->down, 0); _asn1_set_down (p_last, p); } else if (move == RIGHT) { - if (p_last && p_last->right) + while (p_last && p_last->right) _asn1_delete_structure (e_list, &p_last->right, 0); _asn1_set_right (p_last, p); } @@ -318,7 +318,7 @@ _asn1_delete_structure (list_type * e_list, asn1_node * structure, unsigned int flags) { asn1_node p, p2, p3; - + int flag_t = 1; if (*structure == NULL) return ASN1_ELEMENT_NOT_FOUND; @@ -348,7 +348,11 @@ _asn1_delete_structure (list_type * e_list, asn1_node * structure, { p3 = _asn1_find_up (p); if (p3) + { _asn1_set_down (p3, p2); + p2 = NULL; + flag_t = 0; + } else { if (p->right) @@ -356,15 +360,19 @@ _asn1_delete_structure (list_type * e_list, asn1_node * structure, } } else - _asn1_set_right (p3, p2); + { + _asn1_set_right (p3,p2); + p2 = NULL; + flag_t = 0; + } if (e_list) _asn1_delete_node_from_list (e_list, p); _asn1_remove_node (p, flags); - p = NULL; + p = p2; } } } - +if (flag_t) *structure = NULL; return ASN1_SUCCESS; } -- 2.27.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2