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

Author: Olle E. Johansson <[email protected]>
Committer: Olle E. Johansson <[email protected]>
Date: 2017-08-21T12:19:30+02:00

http_client Free the old object when the new can't be allocated properly

---

Modified: src/modules/http_client/curlcon.c

---

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

---

diff --git a/src/modules/http_client/curlcon.c 
b/src/modules/http_client/curlcon.c
index 9a87865837..4789c73f30 100644
--- a/src/modules/http_client/curlcon.c
+++ b/src/modules/http_client/curlcon.c
@@ -172,7 +172,7 @@ curl_con_pkg_t* curl_get_pkg_connection(curl_con_t *con)
                }
                ccp = ccp->next;
        }
-       LM_DBG("curl_get_pkg_connection no success in looking for pkg memory 
for httpcon: [%.*s]\n", con->name.len, con->name.s);
+       LM_ERR("curl_get_pkg_connection no success in looking for pkg memory 
for httpcon: [%.*s]\n", con->name.len, con->name.s);
        return NULL;
 }
 
@@ -751,8 +751,9 @@ curl_con_t *curl_init_con(str *name)
        ccp = (curl_con_pkg_t*) pkg_malloc(sizeof(curl_con_pkg_t));
        if(ccp == NULL)
        {
-               shm_free(ccp);
-               LM_ERR("no shm memory\n");
+               /* We failed to allocate ccp, so let's free cc and quit */
+               shm_free(cc);
+               LM_ERR("no pkg memory available\n");
                return NULL;
        }
 


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to