mtpfs: Fix subdirectory error and issues found by Coverity

:Release Notes:
- Fix the error where files of the lowest level sub-directory don't
  appear.
- Change error return value to general code.
- Fix memory leaks and memory overrun, invalid memory access

:Detailed Notes:

:Testing Performed:
MiniBAT

:QA Notes:

:Issues Addressed:
[GF-45574] CCC: mtpfs=r1 (fix subdirectory error and issues found by
           Coverity)

Open-webOS-DCO-1.0-Signed-off-by: jaesung5.lee <jaesung5.lee@lge.com>
Change-Id: I6647300c4929a9390e4edc727fec8861e0d37903
Reviewed-on: https://g2g.palm.com/3794
Reviewed-by: DCO Verification
Build: Martin Jansa <Martin.Jansa@lge.com>
Reviewed-by: Martin Jansa <Martin.Jansa@lge.com>
Tested-by: Martin Jansa <Martin.Jansa@lge.com>
Reviewed-by: Build Verification
Reviewed-by: Jaesung Lee <jaesung5.lee@lge.com>
Tested-by: Jaesung Lee <jaesung5.lee@lge.com>
Reviewed-by: Herb Kuta <herb.kuta@lge.com>
Reviewed-by: Jongho Kim <jongho1208.kim@lge.com>
Tested-by: Jongho Kim <jongho1208.kim@lge.com>