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>
This commit is contained in:
Simon McVittie 2011-12-12 15:54:50 +00:00
parent edfab83c07
commit 64ca85ceae

View File

@ -174,6 +174,7 @@ g_hmac_copy (const GHmac *hmac)
g_return_val_if_fail (hmac != NULL, NULL); g_return_val_if_fail (hmac != NULL, NULL);
copy = g_slice_new (GHmac); copy = g_slice_new (GHmac);
copy->ref_count = 1;
copy->digest_type = hmac->digest_type; copy->digest_type = hmac->digest_type;
copy->digesti = g_checksum_copy (hmac->digesti); copy->digesti = g_checksum_copy (hmac->digesti);
copy->digesto = g_checksum_copy (hmac->digesto); copy->digesto = g_checksum_copy (hmac->digesto);