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:
parent
16e9f168b9
commit
5aec670621
22
src/work.cpp
22
src/work.cpp
|
@ -268,29 +268,33 @@ void do_files(int i, int argc, char *argv[])
|
||||||
try {
|
try {
|
||||||
do_one_file(iname,oname);
|
do_one_file(iname,oname);
|
||||||
} catch (const Exception &e) {
|
} catch (const Exception &e) {
|
||||||
|
unlink_ofile(oname);
|
||||||
if (opt->verbose >= 2 || (opt->verbose >= 1 && !e.isWarning()))
|
if (opt->verbose >= 2 || (opt->verbose >= 1 && !e.isWarning()))
|
||||||
printErr(iname,&e);
|
printErr(iname,&e);
|
||||||
unlink_ofile(oname);
|
|
||||||
} catch (const Error &e) {
|
} catch (const Error &e) {
|
||||||
|
unlink_ofile(oname);
|
||||||
printErr(iname,&e);
|
printErr(iname,&e);
|
||||||
unlink_ofile(oname);
|
|
||||||
e_exit(EXIT_ERROR);
|
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) {
|
} catch (const exception &e) {
|
||||||
|
unlink_ofile(oname);
|
||||||
printUnhandledException(iname,&e);
|
printUnhandledException(iname,&e);
|
||||||
unlink_ofile(oname);
|
|
||||||
e_exit(EXIT_ERROR);
|
e_exit(EXIT_ERROR);
|
||||||
//throw;
|
|
||||||
} catch (const exception *e) {
|
} catch (const exception *e) {
|
||||||
|
unlink_ofile(oname);
|
||||||
printUnhandledException(iname,e);
|
printUnhandledException(iname,e);
|
||||||
unlink_ofile(oname);
|
|
||||||
e_exit(EXIT_ERROR);
|
e_exit(EXIT_ERROR);
|
||||||
//throw;
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
printUnhandledException(iname,NULL);
|
|
||||||
unlink_ofile(oname);
|
unlink_ofile(oname);
|
||||||
|
printUnhandledException(iname,NULL);
|
||||||
e_exit(EXIT_ERROR);
|
e_exit(EXIT_ERROR);
|
||||||
//throw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WITH_MSS)
|
#if defined(WITH_MSS)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user