summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-12-05 19:33:43 +0100
committerHaru <haru@dotalux.com>2013-12-05 19:33:43 +0100
commit2175dbec8fd4c0e691b2d3ad83e2dd78e834b8a8 (patch)
tree5a06733f3819b19a08d4705b20e7aa5ef35ba38d /src
parent2292d4ea410e4e87501973c3169d136677d3dcde (diff)
downloadhercules-2175dbec8fd4c0e691b2d3ad83e2dd78e834b8a8.tar.gz
hercules-2175dbec8fd4c0e691b2d3ad83e2dd78e834b8a8.tar.bz2
hercules-2175dbec8fd4c0e691b2d3ad83e2dd78e834b8a8.tar.xz
hercules-2175dbec8fd4c0e691b2d3ad83e2dd78e834b8a8.zip
Follow-up to 6f55c00e72ca6db130a84fe92218f73a777428f4
- Fixed a memory leak (bugreport:7885), thanks to rosfus http://hercules.ws/board/tracker/issue-7885-memory-leaks-found-at-20131205-20h31m31s-rev-13617/ Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r--src/char/int_quest.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/char/int_quest.c b/src/char/int_quest.c
index fb90e8206..ce63a5581 100644
--- a/src/char/int_quest.c
+++ b/src/char/int_quest.c
@@ -38,7 +38,7 @@ struct quest *mapif_quests_fromsql(int char_id, int *count) {
stmt = SQL->StmtMalloc(sql_handle);
if (stmt == NULL) {
SqlStmt_ShowDebug(stmt);
- return 0;
+ return NULL;
}
memset(&tmp_quest, 0, sizeof(struct quest));
@@ -70,7 +70,7 @@ struct quest *mapif_quests_fromsql(int char_id, int *count) {
memcpy(&questlog[i++], &tmp_quest, sizeof(tmp_quest));
}
if (i < *count) {
- // Should never. Compact array
+ // Should never happen. Compact array
*count = i;
questlog = aRealloc(questlog, sizeof(struct quest)*i);
}
@@ -215,6 +215,9 @@ int mapif_parse_quest_load(int fd) {
WFIFOSET(fd,num_quests*sizeof(struct quest)+8);
+ if (tmp_questlog)
+ aFree(tmp_questlog);
+
return 0;
}