Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
66dbc5e6
Commit
66dbc5e6
authored
Feb 10, 2016
by
Salvatore Sanfilippo
Browse files
Merge pull request #3072 from yoav-steinberg/cmsgpack_fix
cmsgpack: pass correct osize values to lua allocator
parents
aa953b6e
fdbefc9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
deps/lua/src/lua_cmsgpack.c
View file @
66dbc5e6
...
...
@@ -119,10 +119,10 @@ mp_buf *mp_buf_new(lua_State *L) {
void mp_buf_append(mp_buf *buf, const unsigned char *s, size_t len) {
if (buf->free < len) {
size_t
new
len
=
buf
->
len
+
len
;
size_t new
size
=
(
buf->len+len
)*2
;
buf
->
b
=
(
unsigned
char
*
)
mp_realloc
(
buf
->
L
,
buf
->
b
,
buf
->
len
,
newlen
*
2
);
buf
->
free
=
newlen
;
buf->b = (unsigned char*)mp_realloc(buf->L, buf->b, buf->len
+ buf->free, newsize
);
buf->free = new
size - buf->
len;
}
memcpy(buf->b+buf->len,s,len);
buf->len += len;
...
...
@@ -130,7 +130,7 @@ void mp_buf_append(mp_buf *buf, const unsigned char *s, size_t len) {
}
void mp_buf_free(mp_buf *buf) {
mp_realloc
(
buf
->
L
,
buf
->
b
,
buf
->
len
,
0
);
/* realloc to 0 = free */
mp_realloc(buf->L, buf->b, buf->len
+ buf->free
, 0); /* realloc to 0 = free */
mp_realloc(buf->L, buf, sizeof(*buf), 0);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment