Browse code

slack: free send_data in case of error

- removed unnecessary if conditions

Daniel-Constantin Mierla authored on 11/09/2021 18:06:26
Showing 1 changed files
... ...
@@ -128,6 +128,7 @@ static int _curl_send(const char* uri, str *post_data)
128 128
 	if((curl_handle=curl_easy_init())==NULL) {
129 129
     	LM_ERR("Unable to init cURL library\n");
130 130
 		curl_global_cleanup();
131
+		pkg_free(send_data);
131 132
         return -1;
132 133
     }
133 134
 
... ...
@@ -139,18 +140,14 @@ static int _curl_send(const char* uri, str *post_data)
139 140
 		LM_ERR("slack request send error: %s\n", curl_easy_strerror(res));
140 141
 		curl_easy_cleanup(curl_handle);
141 142
 		curl_global_cleanup();
142
-		if(send_data) {
143
-			pkg_free(send_data);
144
-		}
143
+		pkg_free(send_data);
145 144
 		return -1;
146 145
 	}
147 146
 
148 147
 	LM_INFO("slack request sent [%d]\n", datasz);
149 148
 	curl_easy_cleanup(curl_handle);
150 149
 	curl_global_cleanup();
151
-	if (send_data) {
152
-		pkg_free(send_data);
153
-	}
150
+	pkg_free(send_data);
154 151
 	return 0;
155 152
 }
156 153