[PATCH 5/5] wpp: Free some filename strings after processing an include (Valgrind). (resend)
Matteo Bruni
mbruni at codeweavers.com
Fri Jun 13 08:08:54 CDT 2014
---
libs/wpp/ppl.l | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/libs/wpp/ppl.l b/libs/wpp/ppl.l
index 0c0d2fd..6e0959c 100644
--- a/libs/wpp/ppl.l
+++ b/libs/wpp/ppl.l
@@ -1340,6 +1340,8 @@ static bufferstackentry_t *pop_buffer(void)
bufferstack[bufferstackidx].define->expanding = 0;
else
{
+ includelogicentry_t *iep = NULL;
+
if(!bufferstack[bufferstackidx].should_pop)
{
wpp_callbacks->close(pp_status.file);
@@ -1351,7 +1353,7 @@ static bufferstackentry_t *pop_buffer(void)
pp_entry_t *ppp = pplookup(pp_incl_state.ppp);
if(ppp)
{
- includelogicentry_t *iep = pp_xmalloc(sizeof(includelogicentry_t));
+ iep = pp_xmalloc(sizeof(includelogicentry_t));
if(!iep)
return NULL;
@@ -1366,16 +1368,20 @@ static bufferstackentry_t *pop_buffer(void)
if(pp_status.debug)
fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].line_number, pp_incl_state.ppp, iep->filename);
}
- else
- free(bufferstack[bufferstackidx].include_filename);
}
free(pp_incl_state.ppp);
pp_incl_state = bufferstack[bufferstackidx].incl;
}
+ if (!iep)
+ free(bufferstack[bufferstackidx].include_filename);
+ if (pp_status.input != bufferstack[bufferstackidx].filename)
+ {
+ free((void *)pp_status.input);
+ pp_status.input = bufferstack[bufferstackidx].filename;
+ }
pp_status.line_number = bufferstack[bufferstackidx].line_number;
pp_status.char_number = bufferstack[bufferstackidx].char_number;
- pp_status.input = bufferstack[bufferstackidx].filename;
ncontinuations = bufferstack[bufferstackidx].ncontinuations;
}
--
1.8.5.5
More information about the wine-patches
mailing list