浏览代码

Fixed memleak when player's string variable is cleared

Signed-off-by: Cydh Ramdh <cydh@pservero.com>
Cydh Ramdh 8 年之前
父节点
当前提交
4753407d63
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      src/map/pc.c

+ 2 - 0
src/map/pc.c

@@ -9118,6 +9118,8 @@ int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val)
 				script_array_update(&sd->regs, reg, false);
 			p->value = aStrdup(val);
 		} else {
+			if (p->value)
+				aFree(p->value);
 			p->value = NULL;
 			if( index )
 				script_array_update(&sd->regs, reg, true);