# HG changeset patch # User Thinker K.F. Li # Date 1285161246 -28800 # Node ID 6eaeec6806f2d6b12ecedc4e596ab237b73fa247 # Parent e6c107b2e271a1c0c571299b531974a8f4002091 Fix the issue of potential to free a wild pointer diff -r e6c107b2e271 -r 6eaeec6806f2 src/redraw_man.c --- a/src/redraw_man.c Wed Sep 22 20:47:41 2010 +0800 +++ b/src/redraw_man.c Wed Sep 22 21:14:06 2010 +0800 @@ -1362,7 +1362,7 @@ */ static int compute_area(coord_t *coord) { - static co_aix (*poses)[2]; + static co_aix (*poses)[2] = NULL; static int max_poses = 0; geo_t *geo; int cnt, pos_cnt; @@ -1373,7 +1373,8 @@ } if(max_poses < (cnt * 2)) { - free(poses); + if(poses) + free(poses); max_poses = cnt * 2; poses = (co_aix (*)[2])malloc(sizeof(co_aix [2]) * max_poses); if(poses == NULL)