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
ebda926d
Commit
ebda926d
authored
Mar 12, 2019
by
Antonin Décimo
Committed by
Juliusz Chroboczek
May 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix potential memory leaks.
parent
d53fec04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
configuration.c
configuration.c
+20
-11
No files found.
configuration.c
View file @
ebda926d
...
@@ -325,20 +325,24 @@ get_interface_type(int c, int *type_r, gnc_t gnc, void *closure)
...
@@ -325,20 +325,24 @@ get_interface_type(int c, int *type_r, gnc_t gnc, void *closure)
static
int
static
int
gethex
(
int
c
,
unsigned
char
**
value_r
,
int
*
len_r
,
gnc_t
gnc
,
void
*
closure
)
gethex
(
int
c
,
unsigned
char
**
value_r
,
int
*
len_r
,
gnc_t
gnc
,
void
*
closure
)
{
{
char
*
t
;
char
*
t
=
NULL
;
unsigned
char
*
value
;
unsigned
char
*
value
;
int
len
,
rc
;
int
len
,
rc
;
c
=
getword
(
c
,
&
t
,
gnc
,
closure
);
c
=
getword
(
c
,
&
t
,
gnc
,
closure
);
if
(
c
<
-
1
)
if
(
c
<
-
1
)
{
free
(
t
);
return
c
;
return
c
;
}
len
=
strlen
(
t
);
len
=
strlen
(
t
);
if
(
len
%
2
!=
0
)
{
if
(
len
%
2
!=
0
)
{
free
(
t
);
free
(
t
);
return
-
2
;
return
-
2
;
}
}
value
=
malloc
(
len
/
2
);
value
=
malloc
(
len
/
2
);
if
(
value
==
NULL
)
if
(
value
==
NULL
)
{
free
(
t
);
return
-
2
;
return
-
2
;
}
rc
=
fromhex
(
value
,
t
,
len
);
rc
=
fromhex
(
value
,
t
,
len
);
free
(
t
);
free
(
t
);
...
@@ -714,7 +718,7 @@ static int
...
@@ -714,7 +718,7 @@ static int
parse_ifconf
(
int
c
,
gnc_t
gnc
,
void
*
closure
,
parse_ifconf
(
int
c
,
gnc_t
gnc
,
void
*
closure
,
struct
interface_conf
**
if_conf_return
)
struct
interface_conf
**
if_conf_return
)
{
{
char
*
token
;
char
*
token
=
NULL
;
struct
interface_conf
*
if_conf
;
struct
interface_conf
*
if_conf
;
if_conf
=
calloc
(
1
,
sizeof
(
struct
interface_conf
));
if_conf
=
calloc
(
1
,
sizeof
(
struct
interface_conf
));
...
@@ -736,6 +740,7 @@ parse_ifconf(int c, gnc_t gnc, void *closure,
...
@@ -736,6 +740,7 @@ parse_ifconf(int c, gnc_t gnc, void *closure,
return
parse_anonymous_ifconf
(
c
,
gnc
,
closure
,
if_conf
,
if_conf_return
);
return
parse_anonymous_ifconf
(
c
,
gnc
,
closure
,
if_conf
,
if_conf_return
);
error:
error:
free
(
token
);
free
(
if_conf
);
free
(
if_conf
);
return
-
2
;
return
-
2
;
}
}
...
@@ -765,10 +770,12 @@ parse_key(int c, gnc_t gnc, void *closure, struct key **key_return)
...
@@ -765,10 +770,12 @@ parse_key(int c, gnc_t gnc, void *closure, struct key **key_return)
goto
error
;
goto
error
;
}
}
}
else
if
(
strcmp
(
token
,
"type"
)
==
0
)
{
}
else
if
(
strcmp
(
token
,
"type"
)
==
0
)
{
char
*
auth_type
;
char
*
auth_type
=
NULL
;
c
=
getword
(
c
,
&
auth_type
,
gnc
,
closure
);
c
=
getword
(
c
,
&
auth_type
,
gnc
,
closure
);
if
(
c
<
-
1
||
auth_type
==
NULL
)
if
(
c
<
-
1
||
auth_type
==
NULL
)
{
free
(
auth_type
);
goto
error
;
goto
error
;
}
if
(
strcmp
(
auth_type
,
"none"
)
==
0
)
{
if
(
strcmp
(
auth_type
,
"none"
)
==
0
)
{
key
->
type
=
AUTH_TYPE_NONE
;
key
->
type
=
AUTH_TYPE_NONE
;
}
else
if
(
strcmp
(
auth_type
,
"sha256"
)
==
0
)
{
}
else
if
(
strcmp
(
auth_type
,
"sha256"
)
==
0
)
{
...
@@ -1164,11 +1171,13 @@ parse_config_line(int c, gnc_t gnc, void *closure,
...
@@ -1164,11 +1171,13 @@ parse_config_line(int c, gnc_t gnc, void *closure,
free
(
if_conf
);
free
(
if_conf
);
}
}
}
else
if
(
strcmp
(
token
,
"flush"
)
==
0
)
{
}
else
if
(
strcmp
(
token
,
"flush"
)
==
0
)
{
char
*
token2
;
char
*
token2
=
NULL
;
c
=
skip_whitespace
(
c
,
gnc
,
closure
);
c
=
skip_whitespace
(
c
,
gnc
,
closure
);
c
=
getword
(
c
,
&
token2
,
gnc
,
closure
);
c
=
getword
(
c
,
&
token2
,
gnc
,
closure
);
if
(
c
<
-
1
)
if
(
c
<
-
1
)
{
free
(
token2
);
goto
fail
;
goto
fail
;
}
if
(
strcmp
(
token2
,
"interface"
)
==
0
)
{
if
(
strcmp
(
token2
,
"interface"
)
==
0
)
{
char
*
ifname
=
NULL
;
char
*
ifname
=
NULL
;
int
rc
;
int
rc
;
...
@@ -1204,10 +1213,10 @@ parse_config_line(int c, gnc_t gnc, void *closure,
...
@@ -1204,10 +1213,10 @@ parse_config_line(int c, gnc_t gnc, void *closure,
}
else
if
(
strcmp
(
token
,
"key"
)
==
0
)
{
}
else
if
(
strcmp
(
token
,
"key"
)
==
0
)
{
struct
key
*
key
=
NULL
;
struct
key
*
key
=
NULL
;
c
=
parse_key
(
c
,
gnc
,
closure
,
&
key
);
c
=
parse_key
(
c
,
gnc
,
closure
,
&
key
);
if
(
c
<
-
1
)
if
(
c
<
-
1
||
key
==
NULL
||
key
->
id
==
NULL
)
{
goto
fail
;
free
(
key
);
if
(
key
->
id
==
NULL
)
goto
fail
;
goto
fail
;
}
switch
(
key
->
type
)
{
switch
(
key
->
type
)
{
case
AUTH_TYPE_SHA256
:
case
AUTH_TYPE_SHA256
:
if
(
key
->
len
!=
32
)
{
if
(
key
->
len
!=
32
)
{
...
...
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