summaryrefslogtreecommitdiff
path: root/funcs/func_curl.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2012-04-09 21:47:54 +0000
committerMatthew Jordan <mjordan@digium.com>2012-04-09 21:47:54 +0000
commit38c0a624137aa2bd8b040496869480683452c1d5 (patch)
tree847f90648ccb5678316007e9d96da3df95d97654 /funcs/func_curl.c
parent97f813f3a47c7a808fea1c0b978eda14e0e8190e (diff)
Allow func_curl to exit gracefully if list allocation fails during write
If the global_curl_info data structure could not be allocated, the datastore associated with the operation would be free'd, but the function would not return. This would later dereference the datastore, almost certainly causing Asterisk to crash. With this patch, if the data structure is not allocated the method will return an error code, and not attempt any further operation. ........ Merged revisions 361753 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 361754 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@361755 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs/func_curl.c')
-rw-r--r--funcs/func_curl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/funcs/func_curl.c b/funcs/func_curl.c
index e011461fe..a4328b923 100644
--- a/funcs/func_curl.c
+++ b/funcs/func_curl.c
@@ -302,6 +302,7 @@ static int acf_curlopt_write(struct ast_channel *chan, const char *cmd, char *na
if (!(list = ast_calloc(1, sizeof(*list)))) {
ast_log(LOG_ERROR, "Unable to allocate list head. Cannot set any CURL options\n");
ast_datastore_free(store);
+ return -1;
}
store->data = list;