Fix strdup-related memory leak in nr-softmodem
* strdup is returning a malloced string which needs to be freed after use > Direct leak of 90 byte(s) in 1 object(s) allocated from: > 0 0x7ffff745b9a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454 > 1 0x5555591598a3 in main /executables/nr-softmodem.c:667 > 2 0x7ffff5e29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
This commit is contained in:
committed by
Guido Casati
parent
6435ed309c
commit
a59a69d5e5
@@ -664,7 +664,8 @@ int main( int argc, char **argv ) {
|
||||
#define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
|
||||
#endif
|
||||
// strdup to put the sring in the core file for post mortem identification
|
||||
LOG_I(HW, "Version: %s\n", strdup(PACKAGE_VERSION));
|
||||
char *pckg = strdup(PACKAGE_VERSION);
|
||||
LOG_I(HW, "Version: %s\n", pckg);
|
||||
|
||||
// don't create if node doesn't connect to RRC/S1/GTP
|
||||
const ngran_node_t node_type = get_node_type();
|
||||
@@ -819,6 +820,7 @@ int main( int argc, char **argv ) {
|
||||
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
|
||||
}
|
||||
|
||||
free(pckg);
|
||||
logClean();
|
||||
printf("Bye.\n");
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user