[glib/glib-2-30] g_hmac_copy: initialize the refcount



commit bc2e3d037955ae4419778bf19edb517ddddb4493
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Mon Dec 12 15:54:50 2011 +0000

    g_hmac_copy: initialize the refcount
    
    In practice, the uninitialized refcount will typically mean that the copy is
    never freed, and leaks.
    
    Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666113
    Reviewed-by: Emmanuele Bassi <ebassi linux intel com>

 glib/ghmac.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/glib/ghmac.c b/glib/ghmac.c
index 20e8fcd..3405117 100644
--- a/glib/ghmac.c
+++ b/glib/ghmac.c
@@ -173,6 +173,7 @@ g_hmac_copy (const GHmac *hmac)
   g_return_val_if_fail (hmac != NULL, NULL);
 
   copy = g_slice_new (GHmac);
+  copy->ref_count = 1;
   copy->digest_type = hmac->digest_type;
   copy->digesti = g_checksum_copy (hmac->digesti);
   copy->digesto = g_checksum_copy (hmac->digesto);



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