Skip to content

Commit

Permalink
check whether we own buf before freeing
Browse files Browse the repository at this point in the history
  • Loading branch information
tihmstar committed Aug 14, 2020
1 parent b73ab88 commit c4d55db
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion liboffsetfinder64/machopatchfinder64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ void machopatchfinder64::init(){

if (tryfat) {
printf("got fat macho with first slice at %u\n", (uint32_t) (tryfat - _buf));
free((void*)_buf);
if (_freeBuf) {
free((void*)_buf);
}
_freeBuf = true;
_buf = tryfat;tryfat = NULL;
} else {
printf("got fat macho but failed to parse\n");
Expand Down

0 comments on commit c4d55db

Please sign in to comment.