From 00a698fe8b1babdc323842ee497107d9ed278ebc Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Sat, 27 Aug 2005 20:40:03 +0000 Subject: Fix a memory leak. --- ChangeLog | 1 + src/gui/npc.cpp | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index af87bfa6..c5e261ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ 2005-08-27 Björn Steinbrink + * src/gui/npc.cpp: Fix a memory leak. * src/game.cpp, src/gui/npc.cpp, src/gui/npc.h: Fix the bug when sometimes the last entry in npc list windows is missing. The network buffer isn't reset to all zeros, thus we can't rely on the received diff --git a/src/gui/npc.cpp b/src/gui/npc.cpp index 99d3b3a5..0756d809 100644 --- a/src/gui/npc.cpp +++ b/src/gui/npc.cpp @@ -87,9 +87,7 @@ void NpcListDialog::parseItems(const char *string, unsigned short len) { char *token = strtok(copy, ":"); while (token) { - char *temp = (char*)malloc(strlen(token) + 1); - strcpy(temp, token); - items.push_back(std::string(temp)); + items.push_back(token); token = strtok(NULL, ":"); } -- cgit v1.2.3-70-g09d2