X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/94cfbe9dd4c59b36f41b7ef85b6da9d20274e23d..6361649b9748711b8fbeccae3e713518ab254cad:/net.c diff --git a/net.c b/net.c index 3c8a660..ecbbbfb 100644 --- a/net.c +++ b/net.c @@ -950,8 +950,10 @@ static void perturb(int w, int h, unsigned char *tiles, int wrapping, } sfree(perim2); - if (i == nperim) + if (i == nperim) { + sfree(perimeter); return; /* nothing we can do! */ + } /* * Now we've constructed a new link, we need to find the entire @@ -1650,7 +1652,7 @@ static game_state *new_game(midend *me, game_params *params, char *desc) if (!(barrier(state, x, 0) & U) || !(barrier(state, x, state->height-1) & D)) state->wrapping = TRUE; - for (y = 0; y < state->width; y++) + for (y = 0; y < state->height; y++) if (!(barrier(state, 0, y) & L) || !(barrier(state, state->width-1, y) & R)) state->wrapping = TRUE; @@ -2195,7 +2197,7 @@ static char *interpret_move(game_state *state, game_ui *ui, static game_state *execute_move(game_state *from, char *move) { game_state *ret; - int tx, ty, n, noanim, orig; + int tx = -1, ty = -1, n, noanim, orig; ret = dup_game(from); @@ -2244,6 +2246,7 @@ static game_state *execute_move(game_state *from, char *move) } } if (!noanim) { + if (tx == -1 || ty == -1) { free_game(ret); return NULL; } ret->last_rotate_x = tx; ret->last_rotate_y = ty; }