diff --git a/src/GetFPath.c b/src/GetFPath.c index 813757cc..87d25761 100644 --- a/src/GetFPath.c +++ b/src/GetFPath.c @@ -78,6 +78,11 @@ char **XGetFontPath( length = *(unsigned char *)ch; *ch = '\0'; /* and replace with null-termination */ count++; + } else if (i == 0) { + Xfree(flist); + Xfree(ch); + flist = NULL; + break; } else flist[i] = NULL; } diff --git a/src/ListExt.c b/src/ListExt.c index 0498aa18..a795041d 100644 --- a/src/ListExt.c +++ b/src/ListExt.c @@ -83,6 +83,11 @@ char **XListExtensions( length = *(unsigned char *)ch; *ch = '\0'; /* and replace with null-termination */ count++; + } else if (i == 0) { + Xfree(list); + Xfree(ch); + list = NULL; + break; } else list[i] = NULL; }