[gnome-keyring/gck-work] [gck] Fix double free with copied attributes.



commit 8ea37e4098fea963e7836f97fb75f4648edaca8a
Author: Stef Walter <stef memberwebs com>
Date:   Fri Sep 10 04:52:31 2010 +0000

    [gck] Fix double free with copied attributes.
    
    Copied attributes would result in a double free if length was zero.

 gck/gck-attributes.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gck/gck-attributes.c b/gck/gck-attributes.c
index a691b76..8e6705a 100644
--- a/gck/gck-attributes.c
+++ b/gck/gck-attributes.c
@@ -558,8 +558,8 @@ attribute_init_copy (GckAttribute *dest, const GckAttribute *src, GckAllocator a
 	 */
 
 	memcpy (dest, src, sizeof (GckAttribute));
-	if (src->value && src->length) {
-		dest->value = (allocator) (NULL, src->length);
+	if (src->value) {
+		dest->value = (allocator) (NULL, src->length ? src->length : 1);
 		g_assert (dest->value);
 		memcpy (dest->value, src->value, src->length);
 	}



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