Plug memory leak, filenames relative to installDir
[xboard.git] / winboard / wsettings.c
index db41147..7246590 100644 (file)
@@ -352,8 +352,9 @@ GetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList)
                if(!success) break;\r
                if(!cps) {\r
                    char *p;\r
-                   if(*(char**)optionList[j].target) free(*(char**)optionList[j].target);\r
-                   *(char**)optionList[j].target = p = text;\r
+                   p = (optionList[j].type != FileName ? strdup(text) : InterpretFileName(text, homeDir)); // all files relative to homeDir!\r
+                   FREE(*(char**)optionList[j].target); *(char**)optionList[j].target = p;
+                   free(text); text = p;\r
                    while(*p++ = *text++) if(p[-1] == '\r') p--; // crush CR\r
                    break;\r
                }\r