[PATCH 3/5] wpp: Properly free defines (Valgrind). (resend)

Matteo Bruni mbruni at codeweavers.com
Fri Jun 13 08:08:52 CDT 2014


---
 libs/wpp/preproc.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libs/wpp/preproc.c b/libs/wpp/preproc.c
index 33f69c8..21830d6 100644
--- a/libs/wpp/preproc.c
+++ b/libs/wpp/preproc.c
@@ -292,7 +292,7 @@ void pp_pop_define_state(void)
 
     for (i = 0; i < HASHKEY; i++)
     {
-        while ((ppp = pp_def_state->defines[i]) != NULL) free_pp_entry( ppp, i );
+        while ((ppp = pp_def_state->defines[i]) != NULL) pp_del_define( ppp->ident );
     }
     state = pp_def_state;
     pp_def_state = state->next;
@@ -302,6 +302,7 @@ void pp_pop_define_state(void)
 void pp_del_define(const char *name)
 {
 	pp_entry_t *ppp;
+	int idx = pphash(name);
 
 	if((ppp = pplookup(name)) == NULL)
 	{
@@ -310,13 +311,13 @@ void pp_del_define(const char *name)
 		return;
 	}
 
+	if(pp_status.debug)
+		printf("Deleting (%s, %d) <%s>\n", pp_status.input, pp_status.line_number, name);
+
 	free( ppp->ident );
 	free( ppp->subst.text );
 	free( ppp->filename );
-	free_pp_entry( ppp, pphash(name) );
-
-	if(pp_status.debug)
-		printf("Deleted (%s, %d) <%s>\n", pp_status.input, pp_status.line_number, name);
+	free_pp_entry( ppp, idx );
 }
 
 pp_entry_t *pp_add_define(const char *def, const char *text)
-- 
1.8.5.5




More information about the wine-patches mailing list