[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]
<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++;
|
|