summaryrefslogtreecommitdiffstats
path: root/src/url.c
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2016-04-21 12:27:29 +0000
committerLennart Weller <lhw@ring0.de>2016-04-21 12:27:29 +0000
commit30b94862648cdbf4f537337d2e2f01c369a9dee9 (patch)
treef0219dd8bd744fc09899bd0266402e05a4bff854 /src/url.c
parentImported Upstream version 1.0.0 (diff)
downloadnetdata-30b94862648cdbf4f537337d2e2f01c369a9dee9.tar.xz
netdata-30b94862648cdbf4f537337d2e2f01c369a9dee9.zip
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to 'src/url.c')
-rw-r--r--[-rwxr-xr-x]src/url.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/url.c b/src/url.c
index c4933b205..edf52be7c 100755..100644
--- a/src/url.c
+++ b/src/url.c
@@ -31,6 +31,9 @@ char *url_encode(char *str) {
*buf = malloc(strlen(str) * 3 + 1),
*pbuf = buf;
+ if(!buf)
+ fatal("Cannot allocate memory.");
+
while (*pstr) {
if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~')
*pbuf++ = *pstr;
@@ -56,7 +59,8 @@ char *url_decode(char *str) {
*buf = malloc(strlen(str) + 1),
*pbuf = buf;
- if(!buf) fatal("Cannot allocate memory.");
+ if(!buf)
+ fatal("Cannot allocate memory.");
while (*pstr) {
if (*pstr == '%') {