Module: kamailio
Branch: master
Commit: b2f99145fa7f4088c80dd3e759372445f93f5492
URL: 
https://github.com/kamailio/kamailio/commit/b2f99145fa7f4088c80dd3e759372445f93f5492

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2023-05-31T09:00:27+02:00

cfgt: reworked test on dest.s for freeing

---

Modified: src/modules/cfgt/cfgt_int.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/b2f99145fa7f4088c80dd3e759372445f93f5492.diff
Patch: 
https://github.com/kamailio/kamailio/commit/b2f99145fa7f4088c80dd3e759372445f93f5492.patch

---

diff --git a/src/modules/cfgt/cfgt_int.c b/src/modules/cfgt/cfgt_int.c
index 09a80d1c23..2509b3eb6e 100644
--- a/src/modules/cfgt/cfgt_int.c
+++ b/src/modules/cfgt/cfgt_int.c
@@ -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;
        }
@@ -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)

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to [email protected]

Reply via email to