From: Petr M. <mi...@ph...> - 2003-11-24 15:22:31
|
There seems to be a bug in file variable.c which sometimes causes 'test palette' to segfault. It shows up in some combinations of save_set(), load_file(), and do_string("reset;"); "valgrind" helped to discover the problematic place. It is in routine fontpath_handler(action, path) in case ACTION_GET: Below is an ad-hoc fix -- and actually two possibilities of the fix. Does someone (Harald?) know what that code is doing and propose a correct fix? diff -uwr src/variable.c src-TestPal/variable.c --- src/variable.c 2002-10-11 18:26:00.000000000 +0200 +++ src-TestPal/variable.c 2003-11-23 17:46:33.000000000 +0100 @@ -302,6 +302,7 @@ init_fontpath(); } + switch (action) { case ACTION_CLEAR: /* Clear fontpath, fall through to init */ @@ -516,6 +517,15 @@ else return NULL; } else { +//@@@@@@@@@@@@@@@@@@@ bug in variable.c: +//@@@@@@@@@@@@@@@@@@@ fontpath_handler(action, path) for ACTION_GET: +//@@@@@@@@@@@@@@@@@@@ PETR: WHAT IS CORRECT HERE ??? WHICH FIX? +#if 1 +if (p == NULL) { beenhere = 0; return NULL; } +#else +if (p == NULL) { return NULL; } +#endif +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ END OF A BUG FIX p += strlen(p); /* skip over '\0' */ p++; |