Complete.Org: Mailing Lists: Archives: freeciv-dev: March 1999:
[Freeciv-Dev] Patch: city report crashes client
Home

[Freeciv-Dev] Patch: city report crashes client

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Patch: city report crashes client
From: Patrick Smith <patsmith@xxxxxxxxx>
Date: Thu, 25 Mar 1999 04:39:23 +0000

Here is a patch for a bug in the client.  This bug would sometimes
cause the client to crash with a segmentation violation if you
requested the city report and had built or otherwise acquired many
cities since the last time you requested the report.

The patch is against the March 16 CVS snapshot.

Pat
-- 
patsmith@xxxxxxxxx
--- client/cityrep.c.orig       Thu Mar  4 06:34:09 1999
+++ client/cityrep.c    Wed Mar 24 23:24:25 1999
@@ -713,7 +713,8 @@
     if(n_alloc == 0 || n > n_alloc) {
       int j, n_prev = n_alloc;
       
-      if(!n_alloc) n_alloc=n+1; else n_alloc *= 2;
+      n_alloc *= 2;
+      if (!n_alloc || n_alloc < n) n_alloc = n + 1;
       freelog(LOG_DEBUG, "city report n_alloc increased to %d", n_alloc);
       cities_in_list = realloc(cities_in_list, 
n_alloc*sizeof(*cities_in_list));
       city_list_text = realloc(city_list_text, n_alloc*sizeof(char*));

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Patch: city report crashes client, Patrick Smith <=