Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2003:
[Freeciv-Dev] (PR#4697) Large memory leak in cm.c
Home

[Freeciv-Dev] (PR#4697) Large memory leak in cm.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#4697) Large memory leak in cm.c
From: "mateusz stefek" <matusik_s@xxxxx>
Date: Sat, 26 Jul 2003 00:09:28 -0700
Reply-to: rt@xxxxxxxxxxxxxx

It is possible to waste even 300kB per turn.
The attached patch fixes it.

--
mateusz
--- freeorig/common/aicore/cm.c 2003-05-13 14:26:30.000000000 +0200
+++ freeciv/common/aicore/cm.c  2003-07-26 08:25:34.000000000 +0200
@@ -1150,6 +1150,10 @@
   for (i = 0; i < MAX_FIELDS_USED + 1; i++) {
     for (j = 0; j < MAX_COMBINATIONS; j++) {
       cache3.results[i].combinations[j].is_valid = FALSE;
+      if (cache3.results[i].combinations[j].cache1) {
+        free(cache3.results[i].combinations[j].cache1);
+        cache3.results[i].combinations[j].cache1 = NULL;
+      }
     }
   }
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#4697) Large memory leak in cm.c, mateusz stefek <=