From c4d55dbce5e68d0dc7d437b910e189bdf396101e Mon Sep 17 00:00:00 2001 From: tihmstar Date: Fri, 14 Aug 2020 13:52:07 +0200 Subject: [PATCH] check whether we own buf before freeing --- liboffsetfinder64/machopatchfinder64.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/liboffsetfinder64/machopatchfinder64.cpp b/liboffsetfinder64/machopatchfinder64.cpp index e9f6306..acd1090 100644 --- a/liboffsetfinder64/machopatchfinder64.cpp +++ b/liboffsetfinder64/machopatchfinder64.cpp @@ -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");