mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
(OpenImage): dispose input on exception.
This commit is contained in:
parent
34012bcdd0
commit
1ac0931d62
@ -67,7 +67,15 @@ namespace GameRes
|
|||||||
public virtual IImageDecoder OpenImage (ArcFile arc, Entry entry)
|
public virtual IImageDecoder OpenImage (ArcFile arc, Entry entry)
|
||||||
{
|
{
|
||||||
var input = arc.OpenBinaryEntry (entry);
|
var input = arc.OpenBinaryEntry (entry);
|
||||||
return new ImageFormatDecoder (input);
|
try
|
||||||
|
{
|
||||||
|
return new ImageFormatDecoder (input);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
input.Dispose();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -730,7 +730,15 @@ namespace GameRes
|
|||||||
return arc_fs.Source.OpenImage (entry);
|
return arc_fs.Source.OpenImage (entry);
|
||||||
|
|
||||||
var input = fs.OpenBinaryStream (entry);
|
var input = fs.OpenBinaryStream (entry);
|
||||||
return new ImageFormatDecoder (input);
|
try
|
||||||
|
{
|
||||||
|
return new ImageFormatDecoder (input);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
input.Dispose();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Stream OpenStream (string filename)
|
public static Stream OpenStream (string filename)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user