[Freeciv-Dev] (PR#9898) civserver crashes on multiple games with differe
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#9898) civserver crashes on multiple games with different sizes |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Wed, 1 Sep 2004 09:26:13 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9898 >
Run the server with a map of size 1.
Then don't exit the server, but run it again on a map of size 29.
Boom!
One culprit is local_vector in gotohand.c:find_the_shortest_path().
This patch fixes that. But I think there are other problems also.
jason
? vgcore.pid13998
Index: server/gotohand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gotohand.c,v
retrieving revision 1.181
diff -u -r1.181 gotohand.c
--- server/gotohand.c 9 Aug 2004 05:24:35 -0000 1.181
+++ server/gotohand.c 1 Sep 2004 16:25:33 -0000
@@ -576,7 +576,7 @@
int maxcost = MAXCOST;
int move_cost, total_cost;
int straight_dir = 0; /* init to silence compiler warning */
- static dir_vector *local_vector = NULL;
+ dir_vector local_vector[MAX_MAP_INDEX];
#define LOCAL_VECTOR(x, y) local_vector[map_pos_to_index((x), (y))]
struct unit *pcargo;
/*
@@ -592,9 +592,6 @@
return TRUE; /* [Kero] */
}
- if (!local_vector) {
- local_vector = fc_malloc(map.xsize * map.ysize * sizeof(*local_vector));
- }
BV_CLR_ALL(LOCAL_VECTOR(orig_x, orig_y));
init_warmap(punit->x, punit->y, move_type);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#9898) civserver crashes on multiple games with different sizes,
Jason Short <=
|
|