summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgbhakteX <gurudattax.bhakte@intel.com>2012-07-26 13:23:25 (GMT)
committerShuo Gao <shuo.gao@intel.com>2012-08-14 14:03:10 (GMT)
commita965c0d917b2b2ef9dbd1c773098e3de079be4fd (patch)
tree27c75103cdb2f6ff912a7eb355999a3e92eff2a9
parente6d06460f6936adaf2c5df783700a683fd082878 (diff)
downloadandroid_external_sonivox-a965c0d917b2b2ef9dbd1c773098e3de079be4fd.zip
android_external_sonivox-a965c0d917b2b2ef9dbd1c773098e3de079be4fd.tar.gz
android_external_sonivox-a965c0d917b2b2ef9dbd1c773098e3de079be4fd.tar.bz2
There is fd leak in sonivox lib when try open any media file
> 2GB (MIDI parser memory leak) Midi Parser support only 32 bit file operations and thus files of size less than 2 GB. When file open is called on the Midi parser, for files more than 2GB, internal seek operation fails resulting in the non-closure of the opened file. This resulted in the memory leak of the opened file descriptor. This is fixed by closing the opened file descriptor on failed cases. Change-Id: Ie9f53275206e2b4616d1cfc41c12b90544895548 Author: Muthukumar Kandasamy <muthukumar.kandasamy@intel.com> Signed-off-by: Muthukumar Kandasamy <muthukumar.kandasamy@intel.com> Signed-off-by: Gurudatta Bhakte <gurudattax.bhakte@intel.com> Singed-off-by: Shuo Gao <shuo.gao@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Author-tracking-BZ: 39292
-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 */