diff options
author | Lennart Weller <lhw@ring0.de> | 2016-04-21 12:27:29 +0000 |
---|---|---|
committer | Lennart Weller <lhw@ring0.de> | 2016-04-21 12:27:29 +0000 |
commit | 30b94862648cdbf4f537337d2e2f01c369a9dee9 (patch) | |
tree | f0219dd8bd744fc09899bd0266402e05a4bff854 /src/url.c | |
parent | Imported Upstream version 1.0.0 (diff) | |
download | netdata-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.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/url.c b/src/url.c index c4933b20..edf52be7 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 == '%') { |