Skip to content

Commit

Permalink
fix incorrect buffer size allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmaclarty committed Oct 4, 2019
1 parent e910136 commit 4cf6305
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/am_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ am_buffer *am_push_new_buffer_and_init(lua_State *L, int size) {
// the new buffer will own data and assumes it was allocated
// with system malloc.
am_buffer *am_push_new_buffer_with_data(lua_State *L, int size, void* data) {
am_buffer *buf = new(lua_newuserdata(L, size)) am_buffer();
am_buffer *buf = new(lua_newuserdata(L, sizeof(am_buffer))) am_buffer();
am_set_metatable(L, buf, MT_am_buffer_gc);
buf->data = (uint8_t*)data;
buf->size = size;
Expand Down

0 comments on commit 4cf6305

Please sign in to comment.