From 8acc87667612761c63a21d86a8242d952cb53be6 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 11 May 2011 18:11:28 +0000 Subject: [PATCH] Fix segfault in Loopy printing, introduced when I added the dynamic arrays 'textx' and 'texty' to the game_drawstate but failed to initialise them in the temporary drawstate used by game_print(). Thanks to Arun Giridhar for spotting this. git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9173 cda61777-01e9-0310-a592-d414129be87e --- loopy.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/loopy.c b/loopy.c index e7fb6cb..b84ca82 100644 --- a/loopy.c +++ b/loopy.c @@ -3805,6 +3805,10 @@ static void game_print(drawing *dr, game_state *state, int tilesize) grid *g = state->game_grid; ds->tilesize = tilesize; + ds->textx = snewn(g->num_faces, int); + ds->texty = snewn(g->num_faces, int); + for (i = 0; i < g->num_faces; i++) + ds->textx[i] = ds->texty[i] = -1; for (i = 0; i < g->num_dots; i++) { int x, y; @@ -3874,6 +3878,9 @@ static void game_print(drawing *dr, game_state *state, int tilesize) } } } + + sfree(ds->textx); + sfree(ds->texty); } #ifdef COMBINED -- 2.11.0