qseecom: Fix memory leak when __check_if_app_exist() fail

In qseecom_start_app(), when __check_if_app_exist() returns an
error status, the function is exited  with a -EINVAL error.
This result in not de-allocating memory that was allocated for
the handle prior to calling __check_if_app_exists()

Memory that was allocted for the handle, needs to be de-allocated
before exiting with an error status when __check_if_app_exists()
return a failure.

The fix is to re-order the memory allocation of the handle after
__check_if_app_exists() goes through successfully.

Change-Id: I9dde552deb2296ab719ee815314c9da161a5d1da
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
1 file changed