From 7da8137bdb333d4f8424d098d90331e1fb83fb45 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sat, 27 Jun 2020 20:24:31 -0400 Subject: puzzles: fix crash when loading a corrupt save I misread the documentation here, thinking that the pointer would be set to *point to* a null byte, not to a null pointer itself. [1] [1]: https://www.chiark.greenend.org.uk/~sgtatham/puzzles/devel/midend.html#identify-game Change-Id: I9b76bba9b1611dfd8e05d076a69f7554b5b74c53 --- apps/plugins/puzzles/rockbox.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c index a10bf7dd5c..eabe739657 100644 --- a/apps/plugins/puzzles/rockbox.c +++ b/apps/plugins/puzzles/rockbox.c @@ -3201,9 +3201,8 @@ static bool load_game(void) char *game; const char *ret = identify_game(&game, read_wrapper, (void*)fd); - if(!*game && ret) + if(!game && ret) { - sfree(game); rb->splash(HZ, ret); rb->close(fd); return false; -- cgit v1.2.3