diff options
author | Javier <dev.git@javispedro.com> | 2022-04-16 19:55:32 +0200 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2022-04-16 19:55:32 +0200 |
commit | 9cf5dd38521565ff889dc6b07187742ac67a7454 (patch) | |
tree | 7d20fdde1a00796047ffeca56a17677ef4883d73 /mousmain.c | |
parent | 1075670224d66edba07aa5c100917f3ace7d628c (diff) | |
download | vbados-9cf5dd38521565ff889dc6b07187742ac67a7454.tar.gz vbados-9cf5dd38521565ff889dc6b07187742ac67a7454.zip |
avoid leaking HMA on install error
Diffstat (limited to 'mousmain.c')
-rw-r--r-- | mousmain.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -308,10 +308,7 @@ static __declspec(aborts) int install_driver(LPTSRDATA data, bool high) // If we reallocated ourselves to UMB, // it's time to free our initial conventional memory allocation if (high) { - // We are about to free() our own code segment. - // Nothing should try to allocate memory between this and the TSR call - // below, since it could overwrite our code... - dos_free(_psp); + finish_reallocation(_psp, FP_SEG(data)); } _dos_keep(EXIT_SUCCESS, get_paragraphs(resident_size)); @@ -479,7 +476,10 @@ int main(int argc, const char *argv[]) deallocate_environment(_psp); } err = configure_driver(data); - if (err) return EXIT_FAILURE; + if (err) { + if (high) cancel_reallocation(FP_SEG(data)); + return EXIT_FAILURE; + } return install_driver(data, high); } else if (stricmp(argv[argi], "uninstall") == 0) { if (!data) return driver_not_found(); |