[gnutls-devel] libtasn1 | Fix memleaks in asn1_array2tree() (!29)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Tue Jul 23 14:43:32 CEST 2019




Nikos Mavrogiannopoulos started a new discussion on lib/structure.c: https://gitlab.com/gnutls/libtasn1/merge_requests/29#note_194839181

>        if (*definitions == NULL)
>  	*definitions = p;
>  
> -      if (move == DOWN)
> +      if (move == DOWN) {
> +        if (p_last && p_last->down) {
> +	  _asn1_delete_node_from_list (e_list, p_last->down);
> +	  _asn1_remove_node (p_last->down, 0);
> +	}
>  	_asn1_set_down (p_last, p);
> -      else if (move == RIGHT)
> +      } else if (move == RIGHT) {
> +        if (p_last && p_last->right) {
> +	  _asn1_delete_node_from_list (e_list, p_last->right);
> +	  _asn1_remove_node (p_last->down, 0);

I wonder whether we can use here the [container_of](https://ccodearchive.net/info/container_of.html) to simplify and optimize this removal.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/libtasn1/merge_requests/29#note_194839181
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20190723/1ac1832a/attachment.html>


More information about the Gnutls-devel mailing list