aboutsummaryrefslogtreecommitdiff
path: root/net.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2009-06-17 20:01:45 +0000
committerSimon Tatham <anakin@pobox.com>2009-06-17 20:01:45 +0000
commit0687980f0c3204d283848ba41761a7724e4a6168 (patch)
treefb454b19acbc55db35dd3087648d2dc0de52f0bb /net.c
parent3cd83d05e899e62232b68ea95cf7f07505ebd79f (diff)
downloadpuzzles-0687980f0c3204d283848ba41761a7724e4a6168.zip
puzzles-0687980f0c3204d283848ba41761a7724e4a6168.tar.gz
puzzles-0687980f0c3204d283848ba41761a7724e4a6168.tar.bz2
puzzles-0687980f0c3204d283848ba41761a7724e4a6168.tar.xz
Memory management and other fixes from James H.
[originally from svn r8596]
Diffstat (limited to 'net.c')
-rw-r--r--net.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net.c b/net.c
index 3c8a660..2b5275e 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
@@ -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;
}