Commit 0827b2f5 authored by Robert Schmidt's avatar Robert Schmidt

Fix leaks & unitialized memory in nr_ulschsim

parent 399e6d78
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include "common/config/config_userapi.h" #include "common/config/config_userapi.h"
#include "common/utils/load_module_shlib.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "common/ran_context.h" #include "common/ran_context.h"
#include "PHY/types.h" #include "PHY/types.h"
...@@ -372,7 +373,7 @@ int main(int argc, char **argv) ...@@ -372,7 +373,7 @@ int main(int argc, char **argv)
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *)); RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB)); RC.gNB[0] = calloc(1, sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0]; gNB = RC.gNB[0];
//gNB_config = &gNB->gNB_config; //gNB_config = &gNB->gNB_config;
...@@ -616,6 +617,14 @@ int main(int argc, char **argv) ...@@ -616,6 +617,14 @@ int main(int argc, char **argv)
for (sf = 0; sf < 2; sf++) for (sf = 0; sf < 2; sf++)
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
free_nr_ue_ulsch(&UE->ulsch[sf][0][i], N_RB_UL); free_nr_ue_ulsch(&UE->ulsch[sf][0][i], N_RB_UL);
term_nr_ue_signal(UE, 1);
free(UE);
phy_free_nr_gNB(gNB);
free(gNB->threadPool);
free(gNB->respDecode);
free(RC.gNB[0]);
free(RC.gNB);
free_channel_desc_scm(gNB2UE); free_channel_desc_scm(gNB2UE);
...@@ -625,6 +634,9 @@ int main(int argc, char **argv) ...@@ -625,6 +634,9 @@ int main(int argc, char **argv)
if (input_fd) if (input_fd)
fclose(input_fd); fclose(input_fd);
loader_reset();
logTerm();
return (n_errors); return (n_errors);
} }
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