Browse Source

Fixed memleak when player's string variable is cleared

Signed-off-by: Cydh Ramdh <cydh@pservero.com>
Cydh Ramdh 8 years ago
parent
commit
4753407d63
1 changed files with 2 additions and 0 deletions
  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);