diff options
author | Dan Gudmundsson <[email protected]> | 2015-10-02 13:47:41 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2015-10-02 13:47:41 +0200 |
commit | d22396bce11debcbb6d8826468bd111ac0efbf7b (patch) | |
tree | f0384763e82f8e5c79a5b35753845edc62f9ad8b /lib/mnesia/src | |
parent | 1523be48ab4071b158412f4b06fe9c8d6ba3e73c (diff) | |
download | otp-d22396bce11debcbb6d8826468bd111ac0efbf7b.tar.gz otp-d22396bce11debcbb6d8826468bd111ac0efbf7b.tar.bz2 otp-d22396bce11debcbb6d8826468bd111ac0efbf7b.zip |
mnesia: Fix mnesia:restore/2 which caused a disk_log leak
Introduced a leak of disk_log processes in the rewrite to try-catch.
Diffstat (limited to 'lib/mnesia/src')
-rw-r--r-- | lib/mnesia/src/mnesia_bup.erl | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/mnesia/src/mnesia_bup.erl b/lib/mnesia/src/mnesia_bup.erl index 0e653f2bc4..1f150ae38b 100644 --- a/lib/mnesia/src/mnesia_bup.erl +++ b/lib/mnesia/src/mnesia_bup.erl @@ -157,10 +157,11 @@ fallback_to_schema(Fname) -> read_schema(Mod, Opaque) -> R = #restore{bup_module = Mod, bup_data = Opaque}, try read_schema_section(R) of - {_, {_Header, Schema, _}} -> Schema + {R2, {_Header, Schema, _}} -> + close_read(R2), + Schema catch throw:{error,_} = Error -> Error - after close_read(R) end. %% Open backup media and extract schema @@ -173,8 +174,13 @@ read_schema_section(R) -> do_read_schema_section(R) -> R2 = safe_apply(R, open_read, [R#restore.bup_data]), - {R3, RawSchema} = safe_apply(R2, read, [R2#restore.bup_data]), - do_read_schema_section(R3, verify_header(RawSchema), []). + try + {R3, RawSchema} = safe_apply(R2, read, [R2#restore.bup_data]), + do_read_schema_section(R3, verify_header(RawSchema), []) + catch T:E -> + close_read(R2), + erlang:raise(T,E,erlang:get_stacktrace()) + end. do_read_schema_section(R, {ok, B, C, []}, Acc) -> case safe_apply(R, read, [R#restore.bup_data]) of |