[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src stratagus/construct.c ui/ccl_ui.c...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src stratagus/construct.c ui/ccl_ui.c... |
Date: |
16 Jan 2004 23:02:29 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/01/16 23:02:28
Modified files:
src/stratagus : construct.c
src/ui : ccl_ui.c menus.c
src/unit : unit_draw.c
src/video : cursor.c png.c
Log message:
Memory Leak Fixes
Patches:
Index: stratagus/src/stratagus/construct.c
diff -u stratagus/src/stratagus/construct.c:1.45
stratagus/src/stratagus/construct.c:1.46
--- stratagus/src/stratagus/construct.c:1.45 Thu Jan 15 04:50:02 2004
+++ stratagus/src/stratagus/construct.c Fri Jan 16 23:02:23 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: construct.c,v 1.45 2004/01/14 17:50:02 jsalmon3 Exp $
+// $Id: construct.c,v 1.46 2004/01/16 12:02:23 wizzard Exp $
//@{
@@ -148,7 +148,7 @@
ConstructionFrame* cframe;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: constructions $Id: construct.c,v 1.45
2004/01/14 17:50:02 jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: constructions $Id: construct.c,v 1.46
2004/01/16 12:02:23 wizzard Exp $\n\n");
// FIXME: needed?
@@ -421,7 +421,7 @@
value = LuaToString(l, -2);
if (!strcmp(value, "Tileset")) {
- value = strdup(LuaToString(l,
-1));
+ value = LuaToString(l, -1);
// FIXME: use a general get
tileset function here!
i = 0;
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.185 stratagus/src/ui/ccl_ui.c:1.186
--- stratagus/src/ui/ccl_ui.c:1.185 Thu Jan 15 13:09:55 2004
+++ stratagus/src/ui/ccl_ui.c Fri Jan 16 23:02:24 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_ui.c,v 1.185 2004/01/15 02:09:55 jsalmon3 Exp $
+// $Id: ccl_ui.c,v 1.186 2004/01/16 12:02:24 wizzard Exp $
//@{
@@ -3033,7 +3033,7 @@
lua_error(l);
}
if (lua_isstring(l, -1)) {
- value =
strdup(lua_tostring(l, -1));
+ value = lua_tostring(l,
-1);
func =
(void**)hash_find(MenuFuncHash, value);
if (func != NULL) {
item->d.listbox.action = (void*)*func;
Index: stratagus/src/ui/menus.c
diff -u stratagus/src/ui/menus.c:1.605 stratagus/src/ui/menus.c:1.606
--- stratagus/src/ui/menus.c:1.605 Thu Jan 15 13:09:56 2004
+++ stratagus/src/ui/menus.c Fri Jan 16 23:02:25 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: menus.c,v 1.605 2004/01/15 02:09:56 jsalmon3 Exp $
+// $Id: menus.c,v 1.606 2004/01/16 12:02:25 wizzard Exp $
//@{
@@ -3273,6 +3273,7 @@
FreeMapInfo(fl[i].xdata);
fl[i].xdata = NULL;
}
+ free(fl[i].name);
}
}
@@ -3825,7 +3826,6 @@
DebugLevel0Fn("Start path: %s\n" _C_ ScenSelectPath);
*/
-
CurrentMenu->Items[9].d.button.text = NULL;
EndMenu();
Index: stratagus/src/unit/unit_draw.c
diff -u stratagus/src/unit/unit_draw.c:1.206
stratagus/src/unit/unit_draw.c:1.207
--- stratagus/src/unit/unit_draw.c:1.206 Fri Jan 16 21:35:36 2004
+++ stratagus/src/unit/unit_draw.c Fri Jan 16 23:02:27 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit_draw.c,v 1.206 2004/01/16 10:35:36 wizzard Exp $
+// $Id: unit_draw.c,v 1.207 2004/01/16 12:02:27 wizzard Exp $
//@{
@@ -116,31 +116,29 @@
*/
local Uint32* SelectionColor(const Unit* unit)
{
- Uint32* color;
-
- color = malloc(sizeof(Uint32));
+ static Uint32 color;
// FIXME: make these colors customizable via CVS
if (EditorRunning && unit == UnitUnderCursor &&
EditorState == EditorSelecting) {
- *color = ColorWhite;
- return color;
+ color = ColorWhite;
+ return &color;
}
if (unit->Selected || (unit->Blink & 1)) {
if (unit->Player->Player == PlayerNumNeutral) {
- *color = ColorYellow;
- return color;
+ color = ColorYellow;
+ return &color;
}
// FIXME: better allied?
if (unit->Player == ThisPlayer) {
- *color = ColorGreen;
- return color;
+ color = ColorGreen;
+ return &color;
}
if (IsEnemy(ThisPlayer, unit)) {
- *color = ColorRed;
- return color;
+ color = ColorRed;
+ return &color;
}
return &unit->Player->Color;
}
@@ -148,8 +146,8 @@
// If building mark all own buildings
if (CursorBuilding && unit->Type->Building &&
unit->Player == ThisPlayer) {
- *color = ColorGray;
- return color;
+ color = ColorGray;
+ return &color;
}
return NULL;
}
@@ -660,7 +658,7 @@
{
#if 0
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.206
2004/01/16 10:35:36 wizzard Exp $\n\n");
+ CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.207
2004/01/16 12:02:27 wizzard Exp $\n\n");
CLprintf(file, "(mana-sprite \"%s\" %d %d %d %d)\n",
ManaSprite.File, ManaSprite.HotX, ManaSprite.HotY,
Index: stratagus/src/video/cursor.c
diff -u stratagus/src/video/cursor.c:1.94 stratagus/src/video/cursor.c:1.95
--- stratagus/src/video/cursor.c:1.94 Fri Jan 16 21:35:38 2004
+++ stratagus/src/video/cursor.c Fri Jan 16 23:02:28 2004
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: cursor.c,v 1.94 2004/01/16 10:35:38 wizzard Exp $
+// $Id: cursor.c,v 1.95 2004/01/16 12:02:28 wizzard Exp $
//@{
@@ -239,8 +239,10 @@
buf = alloca(strlen(file) + 9 + 1);
file = strcat(strcpy(buf,"graphics/"), file);
ShowLoadProgress("Cursor %s", file);
- Cursors[i].Sprite = LoadSprite(file,
- Cursors[i].Width, Cursors[i].Height);
+ if (!Cursors[i].Sprite) {
+ Cursors[i].Sprite = LoadSprite(file,
+ Cursors[i].Width, Cursors[i].Height);
+ }
}
}
}
@@ -831,7 +833,7 @@
int i;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: cursors $Id: cursor.c,v 1.94 2004/01/16
10:35:38 wizzard Exp $\n\n");
+ CLprintf(file, ";;; MODULE: cursors $Id: cursor.c,v 1.95 2004/01/16
12:02:28 wizzard Exp $\n\n");
for (i = 0; Cursors[i].OType; ++i) {
CLprintf(file, "(define-cursor '%s '%s\n",
Index: stratagus/src/video/png.c
diff -u stratagus/src/video/png.c:1.31 stratagus/src/video/png.c:1.32
--- stratagus/src/video/png.c:1.31 Thu Jan 15 13:14:08 2004
+++ stratagus/src/video/png.c Fri Jan 16 23:02:28 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: png.c,v 1.31 2004/01/15 02:14:08 jsalmon3 Exp $
+// $Id: png.c,v 1.32 2004/01/16 12:02:28 wizzard Exp $
//@{
@@ -188,12 +188,14 @@
if (!lines) {
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
CLclose(fp);
+ free(palettecolors);
return NULL;
}
data = malloc(h * w);
if (!data) {
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
CLclose(fp);
+ free(palettecolors);
return NULL;
}
#ifdef DEBUG
@@ -213,6 +215,8 @@
graphic = MakeGraphic(8, w, h, data, w * h); // data freed
by make graphic
SDL_SetPalette(graphic->Surface, SDL_LOGPAL | SDL_PHYSPAL,
palettecolors, 0, 256);
SDL_SetColorKey(graphic->Surface, SDL_SRCCOLORKEY | SDL_RLEACCEL, 255);
+
+ free(palettecolors);
return graphic;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src stratagus/construct.c ui/ccl_ui.c...,
address@hidden <=