Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
Free the ecuid_conf in case of memory alllocated

Signed-off-by: Le Van Khanh <[email protected]>
  • Loading branch information
lvklevankhanh committed Feb 9, 2023
1 parent 0642a21 commit b6149e2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/console/dlt-control-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ void set_ecuid(char *ecuid)
if (dlt_parse_config_param("ECUId", &ecuid_conf) == 0) {
memset(local_ecuid, 0, DLT_CTRL_ECUID_LEN);
strncpy(local_ecuid, ecuid_conf, DLT_CTRL_ECUID_LEN);
if (ecuid_conf !=NULL)
free(ecuid_conf);
local_ecuid[DLT_CTRL_ECUID_LEN - 1] = '\0';
}
else {
Expand Down

0 comments on commit b6149e2

Please sign in to comment.