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
2c8a3c31
Commit
2c8a3c31
authored
Mar 25, 2012
by
Józef Kucia
Committed by
Alexandre Julliard
Mar 29, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wpp: Fix a few memory leaks in the wpp_parse() function.
parent
d574e794
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
wpp.c
libs/wpp/wpp.c
+22
-0
No files found.
libs/wpp/wpp.c
View file @
2c8a3c31
...
@@ -49,6 +49,16 @@ static void add_cmdline_defines(void)
...
@@ -49,6 +49,16 @@ static void add_cmdline_defines(void)
}
}
}
}
static
void
del_cmdline_defines
(
void
)
{
struct
define
*
def
;
for
(
def
=
cmdline_defines
;
def
;
def
=
def
->
next
)
{
if
(
def
->
value
)
pp_del_define
(
def
->
name
);
}
}
static
void
add_special_defines
(
void
)
static
void
add_special_defines
(
void
)
{
{
time_t
now
=
time
(
NULL
);
time_t
now
=
time
(
NULL
);
...
@@ -70,6 +80,14 @@ static void add_special_defines(void)
...
@@ -70,6 +80,14 @@ static void add_special_defines(void)
ppp
->
type
=
def_special
;
ppp
->
type
=
def_special
;
}
}
static
void
del_special_defines
(
void
)
{
pp_del_define
(
"__DATE__"
);
pp_del_define
(
"__TIME__"
);
pp_del_define
(
"__FILE__"
);
pp_del_define
(
"__LINE__"
);
}
/* add a define to the preprocessor list */
/* add a define to the preprocessor list */
int
wpp_add_define
(
const
char
*
name
,
const
char
*
value
)
int
wpp_add_define
(
const
char
*
name
,
const
char
*
value
)
...
@@ -182,6 +200,8 @@ int wpp_parse( const char *input, FILE *output )
...
@@ -182,6 +200,8 @@ int wpp_parse( const char *input, FILE *output )
else
if
(
!
(
pp_status
.
file
=
wpp_callbacks
->
open
(
input
,
1
)))
else
if
(
!
(
pp_status
.
file
=
wpp_callbacks
->
open
(
input
,
1
)))
{
{
ppy_error
(
"Could not open %s
\n
"
,
input
);
ppy_error
(
"Could not open %s
\n
"
,
input
);
del_special_defines
();
del_cmdline_defines
();
pp_pop_define_state
();
pp_pop_define_state
();
return
2
;
return
2
;
}
}
...
@@ -198,6 +218,8 @@ int wpp_parse( const char *input, FILE *output )
...
@@ -198,6 +218,8 @@ int wpp_parse( const char *input, FILE *output )
if
(
input
)
wpp_callbacks
->
close
(
pp_status
.
file
);
if
(
input
)
wpp_callbacks
->
close
(
pp_status
.
file
);
/* Clean if_stack, it could remain dirty on errors */
/* Clean if_stack, it could remain dirty on errors */
while
(
pp_get_if_depth
())
pp_pop_if
();
while
(
pp_get_if_depth
())
pp_pop_if
();
del_special_defines
();
del_cmdline_defines
();
pp_pop_define_state
();
pp_pop_define_state
();
return
ret
;
return
ret
;
}
}
...
...
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