Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1b79df4e
Commit
1b79df4e
authored
Jun 26, 2014
by
Matteo Bruni
Committed by
Alexandre Julliard
Jun 26, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wpp: Free some filename strings after processing an include (Valgrind).
parent
18a416f7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
ppl.l
libs/wpp/ppl.l
+11
-5
wpp.c
libs/wpp/wpp.c
+6
-2
wpp_private.h
libs/wpp/wpp_private.h
+1
-1
No files found.
libs/wpp/ppl.l
View file @
1b79df4e
...
...
@@ -213,7 +213,7 @@ typedef struct bufferstackentry {
pp_entry_t *define; /* Points to expanding define or NULL if handling includes */
int line_number; /* Line that we were handling */
int char_number; /* The current position on that line */
c
onst char
*filename; /* Filename that we were handling */
c
har
*filename; /* Filename that we were handling */
int if_depth; /* How many #if:s deep to check matching #endif:s */
int ncontinuations; /* Remember the continuation state */
int should_pop; /* Set if we must pop the start-state on EOF */
...
...
@@ -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)
{
i
ncludelogicentry_t *i
ep = pp_xmalloc(sizeof(includelogicentry_t));
iep = pp_xmalloc(sizeof(includelogicentry_t));
if(!iep)
return NULL;
...
...
@@ -1366,17 +1368,21 @@ 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 (bufferstack[bufferstackidx].include_filename)
{
free(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;
if (!iep)
free(bufferstack[bufferstackidx].include_filename);
}
if(ppy_debug)
...
...
libs/wpp/wpp.c
View file @
1b79df4e
...
...
@@ -206,7 +206,7 @@ int wpp_parse( const char *input, FILE *output )
return
2
;
}
pp_status
.
input
=
input
;
pp_status
.
input
=
input
?
pp_xstrdup
(
input
)
:
NULL
;
ppy_out
=
output
;
pp_writestring
(
"# 1
\"
%s
\"
1
\n
"
,
input
?
input
:
""
);
...
...
@@ -215,7 +215,11 @@ int wpp_parse( const char *input, FILE *output )
/* If there were errors during processing, return an error code */
if
(
!
ret
&&
pp_status
.
state
)
ret
=
pp_status
.
state
;
if
(
input
)
wpp_callbacks
->
close
(
pp_status
.
file
);
if
(
input
)
{
wpp_callbacks
->
close
(
pp_status
.
file
);
free
(
pp_status
.
input
);
}
/* Clean if_stack, it could remain dirty on errors */
while
(
pp_get_if_depth
())
pp_pop_if
();
del_special_defines
();
...
...
libs/wpp/wpp_private.h
View file @
1b79df4e
...
...
@@ -228,7 +228,7 @@ void pp_internal_error(const char *file, int line, const char *s, ...) __attribu
/* everything is in this structure to avoid polluting the global symbol space */
struct
pp_status
{
c
onst
char
*
input
;
/* current input file name */
c
har
*
input
;
/* current input file name */
void
*
file
;
/* current input file descriptor */
int
line_number
;
/* current line number */
int
char_number
;
/* current char number in line */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment