From 06cfb582bd9279879894bfd9cc9e562cc6e4b01e Mon Sep 17 00:00:00 2001 From: rosen0510 Date: Sat, 3 Feb 2018 02:28:17 +0800 Subject: [PATCH] fix memory leak in rebind_symbols_image (#49) * fix memory leak in rebind_symbols_image --- fishhook.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fishhook.c b/fishhook.c index 205ee82..4bdd91d 100644 --- a/fishhook.c +++ b/fishhook.c @@ -187,6 +187,9 @@ int rebind_symbols_image(void *header, struct rebindings_entry *rebindings_head = NULL; int retval = prepend_rebindings(&rebindings_head, rebindings, rebindings_nel); rebind_symbols_for_image(rebindings_head, (const struct mach_header *) header, slide); + if (rebindings_head->rebindings) { + free(rebindings_head->rebindings); + } free(rebindings_head); return retval; }