Skip to content

Commit

Permalink
cfgt: reworked test on dest.s for freeing
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed May 31, 2023
1 parent cb63329 commit b2f9914
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/modules/cfgt/cfgt_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void _cfgt_remove_report(const str *scen)
DIR *folder = NULL;
struct dirent *next_file = NULL;

if(_cfgt_get_filename(0, *scen, &dest, &dir) < 0) {
if(_cfgt_get_filename(0, *scen, &dest, &dir) < 0 || dest.s == NULL) {
LM_ERR("can't build filename for uuid: %.*s\n", scen->len, scen->s);
return;
}
Expand Down Expand Up @@ -124,10 +124,11 @@ void _cfgt_remove_report(const str *scen)
}

end:
if(filepath.s)
if(filepath.s) {
pkg_free(filepath.s);
if(dest.s)
pkg_free(dest.s);
}

pkg_free(dest.s);
}

int _cfgt_remove_uuid(const str *uuid, int remove_report)
Expand Down

0 comments on commit b2f9914

Please sign in to comment.