X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_cgi.c;h=7f248ab04f1feac44885bd971bce88bb7d89e889;hb=88ec7a41d5ba332d0a902a17c0ef0cb01d133a30;hp=4543044c2ad445938dad2a9c536d0bf9ab17f1d4;hpb=d1e55cdc27a837fb0f4c54ed019e3946e7a6e08b;p=rrdtool.git diff --git a/src/rrd_cgi.c b/src/rrd_cgi.c index 4543044..7f248ab 100644 --- a/src/rrd_cgi.c +++ b/src/rrd_cgi.c @@ -83,7 +83,11 @@ static void calfree (void){ /* create freeable version of the string */ char * stralloc(char *str){ - char *nstr = malloc((strlen(str)+1)*sizeof(char)); + char *nstr; + if (str == NULL) { + return NULL; + } + nstr = malloc((strlen(str)+1)*sizeof(char)); strcpy(nstr,str); return(nstr); }