1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Catch std::bad_alloc and print a better error message in this case.

committer: mfx <mfx> 983320394 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2001-02-28 00:33:14 +00:00
parent 16e9f168b9
commit 5aec670621

View File

@ -268,29 +268,33 @@ void do_files(int i, int argc, char *argv[])
try {
do_one_file(iname,oname);
} catch (const Exception &e) {
unlink_ofile(oname);
if (opt->verbose >= 2 || (opt->verbose >= 1 && !e.isWarning()))
printErr(iname,&e);
unlink_ofile(oname);
} catch (const Error &e) {
unlink_ofile(oname);
printErr(iname,&e);
unlink_ofile(oname);
e_exit(EXIT_ERROR);
//throw;
} catch (const std::bad_alloc &e) {
unlink_ofile(oname);
printErr(iname,"out of memory");
e_exit(EXIT_ERROR);
} catch (const std::bad_alloc *e) {
unlink_ofile(oname);
printErr(iname,"out of memory");
e_exit(EXIT_ERROR);
} catch (const exception &e) {
unlink_ofile(oname);
printUnhandledException(iname,&e);
unlink_ofile(oname);
e_exit(EXIT_ERROR);
//throw;
} catch (const exception *e) {
unlink_ofile(oname);
printUnhandledException(iname,e);
unlink_ofile(oname);
e_exit(EXIT_ERROR);
//throw;
} catch (...) {
printUnhandledException(iname,NULL);
unlink_ofile(oname);
printUnhandledException(iname,NULL);
e_exit(EXIT_ERROR);
//throw;
}
#if defined(WITH_MSS)