Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
dbcb8deb
Commit
dbcb8deb
authored
Nov 22, 2019
by
Antonin Décimo
Committed by
Juliusz Chroboczek
Apr 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix potential memory leaks in configuration.
parent
c42a5c83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
configuration.c
configuration.c
+11
-5
No files found.
configuration.c
View file @
dbcb8deb
...
...
@@ -514,7 +514,7 @@ parse_anonymous_ifconf(int c, gnc_t gnc, void *closure,
struct
interface_conf
**
if_conf_return
)
{
char
*
token
;
char
*
token
=
NULL
;
if
(
if_conf
==
NULL
)
{
if_conf
=
calloc
(
1
,
sizeof
(
struct
interface_conf
));
...
...
@@ -657,6 +657,7 @@ parse_anonymous_ifconf(int c, gnc_t gnc, void *closure,
return
c
;
error:
free
(
token
);
if
(
if_conf
)
free
(
if_conf
->
ifname
);
free
(
if_conf
);
...
...
@@ -679,8 +680,10 @@ parse_ifconf(int c, gnc_t gnc, void *closure,
goto
error
;
c
=
getstring
(
c
,
&
token
,
gnc
,
closure
);
if
(
c
<
-
1
||
token
==
NULL
)
if
(
c
<
-
1
||
token
==
NULL
)
{
free
(
token
);
goto
error
;
}
if_conf
->
ifname
=
token
;
...
...
@@ -970,7 +973,7 @@ static int
parse_config_line
(
int
c
,
gnc_t
gnc
,
void
*
closure
,
int
*
action_return
,
const
char
**
message_return
)
{
char
*
token
;
char
*
token
=
NULL
;
if
(
action_return
)
*
action_return
=
CONFIG_ACTION_DONE
;
if
(
message_return
)
...
...
@@ -981,8 +984,10 @@ parse_config_line(int c, gnc_t gnc, void *closure,
return
skip_to_eol
(
c
,
gnc
,
closure
);
c
=
getword
(
c
,
&
token
,
gnc
,
closure
);
if
(
c
<
-
1
)
if
(
c
<
-
1
)
{
free
(
token
);
return
c
;
}
/* Directives allowed in read-only mode */
if
(
strcmp
(
token
,
"quit"
)
==
0
)
{
...
...
@@ -1070,11 +1075,12 @@ parse_config_line(int c, gnc_t gnc, void *closure,
if
(
c
<
-
1
)
goto
fail
;
if
(
strcmp
(
token2
,
"interface"
)
==
0
)
{
char
*
ifname
;
char
*
ifname
=
NULL
;
int
rc
;
c
=
getword
(
c
,
&
ifname
,
gnc
,
closure
);
c
=
skip_eol
(
c
,
gnc
,
closure
);
if
(
c
<
-
1
)
{
free
(
ifname
);
free
(
token2
);
goto
fail
;
}
...
...
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