summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f86731f)
raw | patch | inline | side by side (parent: f86731f)
author | Brandon Arp <brandon.arp@smartsheet.com> | |
Fri, 15 Apr 2016 18:37:44 +0000 (11:37 -0700) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Fri, 15 Apr 2016 19:02:13 +0000 (21:02 +0200) |
make sure that we dont leak memory if curl_slist_append returns null
src/curl.c | patch | blob | history | |
src/curl_json.c | patch | blob | history | |
src/curl_xml.c | patch | blob | history |
diff --git a/src/curl.c b/src/curl.c
index 9d2196ac2c3e57d30858eebcbf83bdb39f4d6970..8b30fa4b0cf668cfb8e83bad92deb617460747ca 100644 (file)
--- a/src/curl.c
+++ b/src/curl.c
static int cc_config_append_string (const char *name, struct curl_slist **dest, /* {{{ */
oconfig_item_t *ci)
{
+ struct curl_slist *temp = NULL;
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("curl plugin: `%s' needs exactly one string argument.", name);
return (-1);
}
- *dest = curl_slist_append(*dest, ci->values[0].value.string);
- if (*dest == NULL)
+ temp = curl_slist_append(*dest, ci->values[0].value.string);
+ if (temp == NULL)
return (-1);
+ *dest = temp;
+
return (0);
} /* }}} int cc_config_append_string */
diff --git a/src/curl_json.c b/src/curl_json.c
index 6b8449c9e40a54f3c4e485e23f7d04b7f1a5029f..2314bfe9bd2c98a464b836dd21b175b3feee2460 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
static int cj_config_append_string (const char *name, struct curl_slist **dest, /* {{{ */
oconfig_item_t *ci)
{
+ struct curl_slist *temp = NULL;
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("curl_json plugin: `%s' needs exactly one string argument.", name);
return (-1);
}
- *dest = curl_slist_append(*dest, ci->values[0].value.string);
- if (*dest == NULL)
+ temp = curl_slist_append(*dest, ci->values[0].value.string);
+ if (temp == NULL)
return (-1);
+ *dest = temp;
+
return (0);
} /* }}} int cj_config_append_string */
diff --git a/src/curl_xml.c b/src/curl_xml.c
index d34b69efee25a4af6c050470117c03535399bf90..9483738bcf637e8178f99c739688be30c73fa954 100644 (file)
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
static int cx_config_append_string (const char *name, struct curl_slist **dest, /* {{{ */
oconfig_item_t *ci)
{
+ struct curl_slist *temp = NULL;
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("curl_xml plugin: `%s' needs exactly one string argument.", name);
return (-1);
}
- *dest = curl_slist_append(*dest, ci->values[0].value.string);
- if (*dest == NULL)
+ temp = curl_slist_append(*dest, ci->values[0].value.string);
+ if (temp == NULL)
return (-1);
+ *dest = temp;
+
return (0);
} /* }}} int cx_config_append_string */