Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2005:
[Freeciv-Dev] Re: (PR#14108) glibc detected *** free(): invalid pointer
Home

[Freeciv-Dev] Re: (PR#14108) glibc detected *** free(): invalid pointer

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: badamson@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#14108) glibc detected *** free(): invalid pointer
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 25 Sep 2005 16:54:01 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14108 >

Benedict Adamson wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=14108 >
> 
> I wrote:
> ...
> 
>>I guess that hash_delete_entry_full() is incorrectly setting old_key.
> 
> ...
> 
> Further investigation supports that guess. hash_delete_entry_full() does 
> not set old_key at all for the case of bucket->used == BUCKET_USED.

Indeed.  I guess I screwed up in updating this patch from S2_0.  This 
patch adds the missing part.  I will commit immediately.

-jason

Index: utility/hash.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/utility/hash.c,v
retrieving revision 1.28
diff -p -u -r1.28 hash.c
--- utility/hash.c      23 Sep 2005 19:23:32 -0000      1.28
+++ utility/hash.c      25 Sep 2005 23:53:37 -0000
@@ -620,6 +620,9 @@ void *hash_delete_entry_full(struct hash
     if (h->free_data_func) {
       h->free_data_func((void*)bucket->data);
     }
+    if (old_key) {
+      *old_key = (void*)bucket->key;
+    }
     zero_hbucket(bucket);
     bucket->used = BUCKET_DELETED;
     h->num_deleted++;

[Prev in Thread] Current Thread [Next in Thread]