mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 11:42:27 +00:00
fix seg fault when the app is called on an invalid url (bug #4389)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5775 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -115,6 +115,7 @@ static int curl_exec(struct ast_channel *chan, void *data)
|
|||||||
curl_easy_perform(curl);
|
curl_easy_perform(curl);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
|
||||||
|
if (chunk.memory) {
|
||||||
chunk.memory[chunk.size] = '\0';
|
chunk.memory[chunk.size] = '\0';
|
||||||
if (chunk.memory[chunk.size - 1] == 10)
|
if (chunk.memory[chunk.size - 1] == 10)
|
||||||
chunk.memory[chunk.size - 1] = '\0';
|
chunk.memory[chunk.size - 1] = '\0';
|
||||||
@@ -122,6 +123,7 @@ static int curl_exec(struct ast_channel *chan, void *data)
|
|||||||
pbx_builtin_setvar_helper(chan, "CURL", chunk.memory);
|
pbx_builtin_setvar_helper(chan, "CURL", chunk.memory);
|
||||||
|
|
||||||
free(chunk.memory);
|
free(chunk.memory);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_ERROR, "Cannot allocate curl structure\n");
|
ast_log(LOG_ERROR, "Cannot allocate curl structure\n");
|
||||||
res = -1;
|
res = -1;
|
||||||
|
Reference in New Issue
Block a user