summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-08-15 09:35:28 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-08-15 09:35:28 -0700
commit3a3161fc408f49972edb16a94c5248169cd513be (patch)
tree44502ed2c8114794f2d8a42a3b9d9cba422693ac
parent7483dd686e68e054c40a1cbf1898fd3613b63782 (diff)
parent0eb1fab72466cd5900470d0a4a2b191722aa9ef5 (diff)
downloadandroid_external_sonivox-3a3161fc408f49972edb16a94c5248169cd513be.tar.gz
android_external_sonivox-3a3161fc408f49972edb16a94c5248169cd513be.tar.bz2
android_external_sonivox-3a3161fc408f49972edb16a94c5248169cd513be.zip
am 0eb1fab7: am 09a0c670: Merge "There is fd leak in sonivox lib when try open any media file > 2GB (MIDI parser memory leak)"
* commit '0eb1fab72466cd5900470d0a4a2b191722aa9ef5': There is fd leak in sonivox lib when try open any media file > 2GB (MIDI parser memory leak)
-rw-r--r--arm-wt-22k/lib_src/eas_public.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/arm-wt-22k/lib_src/eas_public.c b/arm-wt-22k/lib_src/eas_public.c
index 8195b98..51ac423 100644
--- a/arm-wt-22k/lib_src/eas_public.c
+++ b/arm-wt-22k/lib_src/eas_public.c
@@ -630,8 +630,11 @@ EAS_PUBLIC EAS_RESULT EAS_OpenFile (EAS_DATA_HANDLE pEASData, EAS_FILE_LOCATOR l
/* allocate a stream */
if ((streamNum = EAS_AllocateStream(pEASData)) < 0)
+ {
+ /* Closing the opened file as stream allocation failed */
+ EAS_HWCloseFile(pEASData->hwInstData, fileHandle);
return EAS_ERROR_MAX_STREAMS_OPEN;
-
+ }
/* check Configuration Module for file parsers */
pParserModule = NULL;
*ppStream = NULL;
@@ -645,6 +648,9 @@ EAS_PUBLIC EAS_RESULT EAS_OpenFile (EAS_DATA_HANDLE pEASData, EAS_FILE_LOCATOR l
/* see if this parser recognizes it */
if ((result = (*pParserModule->pfCheckFileType)(pEASData, fileHandle, &streamHandle, 0L)) != EAS_SUCCESS)
{
+ /* Closing the opened file as file type check failed */
+ EAS_HWCloseFile(pEASData->hwInstData, fileHandle);
+
{ /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "CheckFileType returned error %ld\n", result); */ }
return result;
}
@@ -661,7 +667,12 @@ EAS_PUBLIC EAS_RESULT EAS_OpenFile (EAS_DATA_HANDLE pEASData, EAS_FILE_LOCATOR l
/* rewind the file for the next parser */
if ((result = EAS_HWFileSeek(pEASData->hwInstData, fileHandle, 0L)) != EAS_SUCCESS)
+ {
+ /* Closing the opened file as file seek failed */
+ EAS_HWCloseFile(pEASData->hwInstData, fileHandle);
+
return result;
+ }
}
/* no parser was able to recognize the file, close it and return an error */