Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-RAN
Commits
11a31817
Commit
11a31817
authored
Feb 18, 2021
by
Laurent Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
memory wrong free in global vars used for configuration storage
parent
c93482c4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
2 deletions
+10
-2
common/config/config_load_configmodule.c
common/config/config_load_configmodule.c
+2
-1
common/config/config_load_configmodule.h
common/config/config_load_configmodule.h
+3
-0
common/config/config_userapi.c
common/config/config_userapi.c
+4
-1
common/config/libconfig/config_libconfig.c
common/config/libconfig/config_libconfig.c
+1
-0
No files found.
common/config/config_load_configmodule.c
View file @
11a31817
...
...
@@ -331,9 +331,10 @@ void end_configmodule(void) {
printf
(
"[CONFIG] free %u config value pointers
\n
"
,
cfgptr
->
numptrs
);
for
(
int
i
=
0
;
i
<
cfgptr
->
numptrs
;
i
++
)
{
if
(
cfgptr
->
ptrs
[
i
]
!=
NULL
)
{
if
(
cfgptr
->
ptrs
[
i
]
!=
NULL
&&
cfgptr
->
ptrsAllocated
[
i
]
==
true
)
{
free
(
cfgptr
->
ptrs
[
i
]);
cfgptr
->
ptrs
[
i
]
=
NULL
;
cfgptr
->
ptrsAllocated
[
i
]
=
false
;
}
}
...
...
common/config/config_load_configmodule.h
View file @
11a31817
...
...
@@ -36,6 +36,8 @@
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include "common/config/config_paramdesc.h"
#include "common/utils/T/T.h"
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2...
...
...
@@ -74,6 +76,7 @@ typedef struct configmodule_interface {
uint32_t
numptrs
;
uint32_t
rtflags
;
char
*
ptrs
[
CONFIG_MAX_ALLOCATEDPTRS
];
bool
ptrsAllocated
[
CONFIG_MAX_ALLOCATEDPTRS
];
}
configmodule_interface_t
;
#ifdef CONFIG_LOADCONFIG_MAIN
...
...
common/config/config_userapi.c
View file @
11a31817
...
...
@@ -62,6 +62,7 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
if
(
(
cfgoptions
->
paramflags
&
PARAMFLAG_NOFREE
)
==
0
)
{
config_get_if
()
->
ptrs
[
config_get_if
()
->
numptrs
]
=
(
char
*
)
ptr
;
config_get_if
()
->
ptrsAllocated
[
config_get_if
()
->
numptrs
]
=
true
;
config_get_if
()
->
numptrs
++
;
}
}
else
{
...
...
@@ -82,7 +83,9 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
}
if
(
*
ptr
==
NULL
)
{
*
ptr
=
malloc
(
length
>
40
?
length
:
40
);
// LTS: dummy fix, waiting Francois full fix in 4G branch
*
ptr
=
malloc
(
length
>
40
?
length
:
40
);
// LTS: dummy fix, waiting Francois full fix in 4G branch
// the issue is we don't know at this point the size we will get
if
(
*
ptr
!=
NULL
)
{
memset
(
*
ptr
,
0
,
length
);
...
...
common/config/libconfig/config_libconfig.c
View file @
11a31817
...
...
@@ -346,6 +346,7 @@ int config_libconfig_init(char *cfgP[], int numP) {
libconfig_privdata
.
configfile
=
strdup
((
char
*
)
cfgP
[
0
]);
config_get_if
()
->
numptrs
=
0
;
memset
(
config_get_if
()
->
ptrs
,
0
,
sizeof
(
void
*
)
*
CONFIG_MAX_ALLOCATEDPTRS
);
memset
(
config_get_if
()
->
ptrsAllocated
,
0
,
sizeof
(
config_get_if
()
->
ptrsAllocated
));
/* Read the file. If there is an error, report it and exit. */
if
(
!
config_read_file
(
&
(
libconfig_privdata
.
cfg
),
libconfig_privdata
.
configfile
))
{
...
...
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