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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-02-14T12:40:57+01:00

http_client: free dumplicated name in case of errors

---

Modified: src/modules/http_client/curlcon.c

---

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

---

diff --git a/src/modules/http_client/curlcon.c 
b/src/modules/http_client/curlcon.c
index 16dfb6cc09b..3582ecde199 100644
--- a/src/modules/http_client/curlcon.c
+++ b/src/modules/http_client/curlcon.c
@@ -582,21 +582,29 @@ int curl_parse_conn(void *param, cfg_parser_t *parser, 
unsigned int flags)
                                t.start.line, t.start.col);
                return -1;
        }
-       pkg_str_dup(&name, &t.val);
+       if(pkg_str_dup(&name, &t.val) < 0) {
+               return -1;
+       }
        ret = cfg_get_token(&t, parser, 0);
-       if(ret < 0)
+       if(ret < 0) {
+               pkg_free(name.s);
                return -1;
+       }
        if((ret > 0) || (t.type != ']')) {
                LM_ERR("%s:%d:%d: Syntax error, ']' expected\n", parser->file,
                                t.start.line, t.start.col);
+               pkg_free(name.s);
                return -1;
        }
 
-       if(cfg_eat_eol(parser, flags))
+       if(cfg_eat_eol(parser, flags)) {
+               pkg_free(name.s);
                return -1;
+       }
 
        raw_cc = pkg_malloc(sizeof(raw_http_client_conn_t));
        if(raw_cc == NULL) {
+               pkg_free(name.s);
                return -1;
        }
        memset(raw_cc, 0, sizeof(raw_http_client_conn_t));

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to