Module: kamailio
Branch: master
Commit: eb204c0f99247e7ee5356201a8d0d46e5808ddad
URL:
https://github.com/kamailio/kamailio/commit/eb204c0f99247e7ee5356201a8d0d46…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-09-13T08:06:26+02:00
slack: free send_data in case of error
- removed unnecessary if conditions
---
Modified: src/modules/slack/slack.c
---
Diff:
https://github.com/kamailio/kamailio/commit/eb204c0f99247e7ee5356201a8d0d46…
Patch:
https://github.com/kamailio/kamailio/commit/eb204c0f99247e7ee5356201a8d0d46…
---
diff --git a/src/modules/slack/slack.c b/src/modules/slack/slack.c
index 7a046d387a..30ab96bed4 100644
--- a/src/modules/slack/slack.c
+++ b/src/modules/slack/slack.c
@@ -128,6 +128,7 @@ static int _curl_send(const char* uri, str *post_data)
if((curl_handle=curl_easy_init())==NULL) {
LM_ERR("Unable to init cURL library\n");
curl_global_cleanup();
+ pkg_free(send_data);
return -1;
}
@@ -139,18 +140,14 @@ static int _curl_send(const char* uri, str *post_data)
LM_ERR("slack request send error: %s\n", curl_easy_strerror(res));
curl_easy_cleanup(curl_handle);
curl_global_cleanup();
- if(send_data) {
- pkg_free(send_data);
- }
+ pkg_free(send_data);
return -1;
}
LM_INFO("slack request sent [%d]\n", datasz);
curl_easy_cleanup(curl_handle);
curl_global_cleanup();
- if (send_data) {
- pkg_free(send_data);
- }
+ pkg_free(send_data);
return 0;
}