diff options
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 == '%') { |