summaryrefslogtreecommitdiffstats
path: root/src/url.c
diff options
context:
space:
mode:
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 == '%') {