I had noticed something similar to this in the past, but I thought it
was resolved. I'll check into it and get back to you.

Thanks!

-- 
------------------------------------------------------------------------
| Nathan Ingersoll          \\  Computer Systems & Network Coordinator |
| [EMAIL PROTECTED]   \\  http://www.ruralcenter.org            |
| http://ningerso.atmos.org/  \\  Rural Health Resource Center         |
------------------------------------------------------------------------

On Sat, May 01, 2004 at 04:17:12PM +0100, Gen Zhang wrote:
> =2D----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I've just been running a program through valgrind, and looking for memory=20
> leaks. There appears to be one concerning hashes:
> 
> int main(int argc, char ** argv)
> {
>       Ecore_Hash * hash =3D ecore_hash_new(ecore_str_hash, ecore_str_compare);
>       ecore_hash_set_free_key(hash, free);
>       ecore_hash_set_free_value(hash, free);
>       ecore_hash_set(hash, strdup("yo"), strdup("mofo"));
>       free(ecore_hash_remove(hash, "yo"));
>       ecore_hash_destroy(hash);
> 
>       return 0;
> }
> 
> I don't know if this is because I haven't used the library properly, but it=
> =20
> appears that upon ecore_hash_remove the original string strdup'ed "yo" isn'=
> t=20
> freed. However, the following diff causes double free's when=20
> ecoree_hash_destroy is called:
> 
> Index: ecore_hash.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore/ecore_hash.c,v
> retrieving revision 1.3
> diff -u -r1.3 ecore_hash.c
> =2D --- ecore_hash.c        30 Apr 2004 03:10:15 -0000      1.3
> +++ ecore_hash.c        1 May 2004 15:12:35 -0000
> @@ -347,6 +347,7 @@
>                         ecore_list_remove(list);
> 
>                         ret =3D node->value;
> +                       hash->free_key(node->key);
>                         FREE(node);
>                 }
>         }
> 
> I traced the problem into _ecore_hash_node_destroy, but I don't know what=20
> other functions call it, so I'm a bit disinclined to just take the free out=
> =20
> of there.
> 
> Genneth
> =2D----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
> 
> iD8DBQFAk7961N42u6LLBTERAplrAJ4hg3qtMt3jjwzMSv/llbKca9oelgCgrcR5
> wrVziCbqdjbqxz5FccvEe4g=3D
> =3D6VHQ
> =2D----END PGP SIGNATURE-----
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: Oracle 10g
> Get certified on the hottest thing ever to hit the market... Oracle 10g. 
> Take an Oracle 10g class now, and we'll give you the exam FREE. 
> http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
> _______________________________________________
> enlightenment-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Attachment: signature.asc
Description: Digital signature

Reply via email to