Skip to content

Commit

Permalink
free new header if size is too small
Browse files Browse the repository at this point in the history
  • Loading branch information
cryslith committed Jul 26, 2017
1 parent fe51e85 commit 06a42e6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/protocol/header.lua
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ function header:new_from_mem (mem, size)
local o = _new(self)
local header = o._header
if ffi.sizeof(header.t) > size then
o:free()
return nil
end
header.box[0] = ffi.cast(header.ptr_t, mem)
Expand Down

0 comments on commit 06a42e6

Please sign in to comment.