Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] (PR#18760) [Bugfix] Memory leak in hunter code
Home

[Freeciv-Dev] (PR#18760) [Bugfix] Memory leak in hunter code

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#18760) [Bugfix] Memory leak in hunter code
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Thu, 20 Jul 2006 15:19:28 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=18760 >


  Fix attached


  - ML

diff -Nurd -X.diff_ignore freeciv/ai/aihunt.c freeciv/ai/aihunt.c
--- freeciv/ai/aihunt.c 2006-07-20 21:38:16.062500000 +0300
+++ freeciv/ai/aihunt.c 2006-07-21 01:15:38.078125000 +0300
@@ -408,6 +408,7 @@
       struct player *aplayer = unit_owner(target);
       int dist1, dist2, stackthreat = 0, stackcost = 0;
       int sanity_target = target->id;
+      struct pf_path *path;
 
       /* Note that we need not (yet) be at war with aplayer */
       if (!is_player_dangerous(pplayer, aplayer)) {
@@ -500,10 +501,13 @@
       }
 
       /* Go towards it. */
-      if (!ai_unit_execute_path(punit, pf_get_path(map, target->tile))) {
+      path = pf_get_path(map, target->tile);
+      if (!ai_unit_execute_path(punit, path)) {
+        pf_destroy_path(path);
         pf_destroy_map(map);
         return 0;
       }
+      pf_destroy_path(path);
 
       /* Check if we can nuke it now */
       ai_hunter_try_launch(pplayer, punit, target);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#18760) [Bugfix] Memory leak in hunter code, Marko Lindqvist <=