Re: [PATCH libcacard] Use proper free function for PK11_ReadRawAttribute call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks good to me,
Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

On Wed, Aug 15, 2018 at 10:30:38AM +0100, Frediano Ziglio wrote:
> As documented in PK11_ReadRawAttribute data should be freed with
> PORT_Free, not free or g_free.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  src/vcard_emul_nss.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/vcard_emul_nss.c b/src/vcard_emul_nss.c
> index 9658c5a..43707d0 100644
> --- a/src/vcard_emul_nss.c
> +++ b/src/vcard_emul_nss.c
> @@ -1312,6 +1312,7 @@ vcard_emul_read_object(VCard *card, const char *label,
>      PK11GenericObject *obj, *firstObj, *myObj = NULL;
>      SECItem result;
>      SECStatus r;
> +    unsigned char *ret;
>  
>      slot = vcard_emul_card_get_slot(card);
>  
> @@ -1330,7 +1331,7 @@ vcard_emul_read_object(VCard *card, const char *label,
>              && memcmp(label, result.data, result.len) == 0)
>              found = 1;
>  
> -        free(result.data);
> +        PORT_Free(result.data);
>          result.data = NULL;
>  
>          if (found) {
> @@ -1351,8 +1352,9 @@ vcard_emul_read_object(VCard *card, const char *label,
>          return NULL;
>  
>      *ret_len = result.len;
> -    return result.data;
> -
> +    ret = g_memdup(result.data, result.len);
> +    PORT_Free(result.data);
> +    return ret;
>  }
>  
>  void
> -- 
> 2.17.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]