Index: client/attribute.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/attribute.c,v retrieving revision 1.12 diff -u -r1.12 attribute.c --- client/attribute.c 2002/06/08 10:50:20 1.12 +++ client/attribute.c 2002/06/21 07:18:55 @@ -48,6 +48,26 @@ } /**************************************************************************** +... +*****************************************************************************/ +void attribute_free() +{ + int i, entries = hash_num_entries(attribute_hash); + + assert(attribute_hash != NULL); + + for (i = 0; i < entries; i++) { + const void *pkey = hash_key_by_number(attribute_hash, 0); + void *pvalue = hash_delete_entry(attribute_hash, pkey); + + free(pvalue); + } + + hash_free(attribute_hash); + attribute_hash = NULL; +} + +/**************************************************************************** This method isn't endian safe and there will also be problems if sizeof(int) at serialization time is different from sizeof(int) at deserialization time. Index: client/attribute.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/attribute.h,v retrieving revision 1.5 diff -u -r1.5 attribute.h --- client/attribute.h 2002/04/12 13:50:55 1.5 +++ client/attribute.h 2002/06/21 07:18:55 @@ -47,6 +47,7 @@ * Generic methods. */ void attribute_init(void); +void attribute_free(void); void attribute_flush(void); void attribute_restore(void); void attribute_set(int key, int id, int x, int y, size_t data_length, Index: client/civclient.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v retrieving revision 1.134 diff -u -r1.134 civclient.c --- client/civclient.c 2002/06/07 04:25:58 1.134 +++ client/civclient.c 2002/06/21 07:18:55 @@ -584,6 +584,8 @@ client_remove_all_cli_conn(); set_unit_focus_no_center(NULL); clear_notify_window(); + attribute_free(); + attribute_init(); game_free(); game_init(); }