Commit b1609e05 authored by Guido Casati's avatar Guido Casati

Fix memory leak in nr-uesoftmodem

* strdup is returning a malloced string that needs to 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 0x555556c7b341 in main /executables/nr-uesoftmodem.c:461
    >2 0x7ffff5e29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
parent e8063159
......@@ -458,7 +458,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);
PHY_vars_UE_g = malloc(sizeof(*PHY_vars_UE_g) * NB_UE_INST);
for (int inst = 0; inst < NB_UE_INST; inst++) {
......@@ -593,6 +594,7 @@ int main(int argc, char **argv)
}
}
free(pckg);
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment