-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Free memory in Parodus during exit/shutdown #425
Conversation
Signed-off-by: Mohamed Shaikh <mohamed.shaikh@t-systems.com>
Insecure Processing of Data (8)
More info on how to fix Insecure Processing of Data in C/C++. 👉 Go to the dashboard for detailed results. 📥 Happy? Share your feedback with us. |
src/config.c
Outdated
@@ -711,6 +711,50 @@ int parseCommandLine(int argc,char **argv,ParodusCfg * cfg) | |||
return 0; | |||
} | |||
|
|||
void free_cfg(ParodusCfg *cfg) | |||
{ | |||
if (cfg->mtls_client_cert_path != NULL ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add cfg NULL check and see if it is helping to fix warning, and assign cfg to NULL at the end once elements are freed .
cfg can be NULL as per this
Line 762 in 3661184
ParodusError("cfg is NULL\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cfg I traced back is pointer to static global struct variable so ideally we should not assign it NULL
https://github.com/xmidt-org/parodus/blob/master/src/config.c#L44
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added NULL check but not able to run guardrails again to confirm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sadhyama Any update on this?
3661184
to
03a5b96
Compare
This code looks correct to me. I'm merging it. |
@@ -231,6 +231,9 @@ void createSocketConnection(void (* initKeypress)()) | |||
nopoll_ctx_unref(ctx); | |||
nopoll_cleanup_library(); | |||
curl_global_cleanup(); | |||
clear_metadata(); | |||
rdk_logger_deinit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Facing build error due to this in local Ubuntu pc,
/usr/bin/ld: CMakeFiles/parodus.dir/conn_interface.c.o: in function createSocketConnection': conn_interface.c:(.text+0x89b): undefined reference to
rdk_logger_deinit'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/parodus.dir/build.make:519: src/parodus] Error 1
make[1]: *** [CMakeFiles/Makefile2:1274: src/CMakeFiles/parodus.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shilpa24balaji Could you please help to check this ?
rdk_logger_deinit func is not available in local pc code hence this error.
For now we are proceeding by disabling this func call from conn_interface.c
To free memory of few config in Parodus during the shutdown case