diff --git a/src/kernel/core/elf.c b/src/kernel/core/elf.c index ad754af45b..864f26259e 100644 --- a/src/kernel/core/elf.c +++ b/src/kernel/core/elf.c @@ -558,6 +558,9 @@ insert_preloaded_image(struct preloaded_image *preloadedImage) goto error2; register_elf_image(image); + preloadedImage->id = image->id; + // modules_init() uses this information to get the preloaded images + return B_OK; error2: @@ -565,6 +568,11 @@ error2: error1: free(elfHeader); + // clean up preloaded image resources (this image won't be used anymore) + delete_area(preloadedImage->text_region.id); + delete_area(preloadedImage->data_region.id); + preloadedImage->id = -1; + return status; }