[gnome-keyring] gkm-gnome2-file: Fix leak in validate_buffer()
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring] gkm-gnome2-file: Fix leak in validate_buffer()
- Date: Tue, 14 Oct 2014 16:18:39 +0000 (UTC)
commit 5a98866f4b7c89451c95e8d559e8f2021c5e1456
Author: Christophe Fergeau <cfergeau redhat com>
Date: Mon Sep 15 19:20:34 2014 +0200
gkm-gnome2-file: Fix leak in validate_buffer()
'check' is allocated in this function but never freed.
https://bugzilla.gnome.org/show_bug.cgi?id=738508
pkcs11/gnome2-store/gkm-gnome2-file.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/pkcs11/gnome2-store/gkm-gnome2-file.c b/pkcs11/gnome2-store/gkm-gnome2-file.c
index 53ad76d..d533fbb 100644
--- a/pkcs11/gnome2-store/gkm-gnome2-file.c
+++ b/pkcs11/gnome2-store/gkm-gnome2-file.c
@@ -309,6 +309,7 @@ validate_buffer (EggBuffer *buffer, gsize *offset)
gsize n_hash, hash_offset;
guint32 length;
int algo;
+ gboolean valid;
g_assert (buffer);
g_assert (offset);
@@ -337,10 +338,10 @@ validate_buffer (EggBuffer *buffer, gsize *offset)
check = g_malloc0 (n_hash);
gcry_md_hash_buffer (algo, check, buffer->buf, length);
- if (memcmp (check, hash, n_hash) != 0)
- return FALSE;
+ valid = (memcmp (check, hash, n_hash) == 0);
+ g_free (check);
- return TRUE;
+ return valid;
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]