*fixed a memory leak with string manipulation.

This commit is contained in:
Wang Renxin 2015-11-03 14:03:04 +08:00
parent 6acd5f1ff0
commit 6c40ba037e

View File

@ -81,7 +81,7 @@ extern "C" {
/** Macros */
#define _VER_MAJOR 1
#define _VER_MINOR 1
#define _VER_REVISION 96
#define _VER_REVISION 97
#define _VER_SUFFIX
#define _MB_VERSION ((_VER_MAJOR * 0x01000000) + (_VER_MINOR * 0x00010000) + (_VER_REVISION))
#define _STRINGIZE(A) _MAKE_STRINGIZE(A)
@ -2727,6 +2727,7 @@ int _calc_expression(mb_interpreter_t* s, _ls_node_t** l, _object_t** val) {
(*val)->data.string = (char*)mb_malloc(_sl + 1);
(*val)->data.string[_sl] = '\0';
memcpy((*val)->data.string, _str, _sl + 1);
(*val)->ref = false;
} else if(c->type == _DT_ARRAY) {
(*val)->data = c->data;
c->type = _DT_NIL;