From 916a2445383d3ed94e8f17ca33e45333aea2251c Mon Sep 17 00:00:00 2001 From: mquinson Date: Mon, 21 Jun 2004 17:02:45 +0000 Subject: [PATCH] Plug a memleak when using gras_dynar_cursor_rm git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@120 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/xbt/dynar.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/xbt/dynar.c b/src/xbt/dynar.c index 16a5f00e12..b039d3495f 100644 --- a/src/xbt/dynar.c +++ b/src/xbt/dynar.c @@ -546,10 +546,13 @@ gras_dynar_cursor_get(const gras_dynar_t * const dynar, * @dynar: * @cursor: * - * Remove the entry pointed by the cursor, for use in the middle of a foreach + * Remove (free) the entry pointed by the cursor, for use in the middle of a foreach */ void gras_dynar_cursor_rm(gras_dynar_t * dynar, int * const cursor) { - - gras_dynar_remove_at(dynar,(*cursor)--,NULL); + void *dst; + + gras_dynar_remove_at(dynar,(*cursor)--,&dst); + if (dynar->free) + (dynar->free)(dst); } -- 2.20.1