X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmisc.c;fp=src%2Fmisc.c;h=b6f8f940acb5817e270ec39e71c88fc69336508c;hb=f806f2ad0dfa82c3abd3d027250a549ca22f4374;hp=40bfad4bf83cea07b73f21b6fd9d25e5f0301fb1;hpb=6a5685ceb73a6e3375ff32c0d6ff383eac9a2a9d;p=rocksndiamonds.git diff --git a/src/misc.c b/src/misc.c index 40bfad4b..b6f8f940 100644 --- a/src/misc.c +++ b/src/misc.c @@ -334,7 +334,12 @@ char *getPath3(char *path1, char *path2, char *path3) char *getStringCopy(char *s) { - char *s_copy = checked_malloc(strlen(s) + 1); + char *s_copy; + + if (s == NULL) + return NULL; + + s_copy = checked_malloc(strlen(s) + 1); strcpy(s_copy, s); return s_copy;