mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 13:20:30 +00:00
(Android) Camera - avoid potential memory leaks
This commit is contained in:
parent
0ce62ed346
commit
98d937d9e0
@ -51,39 +51,42 @@ static void *android_camera_init(const char *device, uint64_t caps, unsigned wid
|
|||||||
|
|
||||||
env = jni_thread_getenv();
|
env = jni_thread_getenv();
|
||||||
if (!env)
|
if (!env)
|
||||||
return NULL;
|
goto dealloc;
|
||||||
|
|
||||||
GET_OBJECT_CLASS(env, class, android_app->activity->clazz);
|
GET_OBJECT_CLASS(env, class, android_app->activity->clazz);
|
||||||
if (class == NULL)
|
if (class == NULL)
|
||||||
return NULL;
|
goto dealloc;
|
||||||
|
|
||||||
GET_METHOD_ID(env, androidcamera->onCameraInit, class, "onCameraInit", "()V");
|
GET_METHOD_ID(env, androidcamera->onCameraInit, class, "onCameraInit", "()V");
|
||||||
if (!androidcamera->onCameraInit)
|
if (!androidcamera->onCameraInit)
|
||||||
return NULL;
|
goto dealloc;
|
||||||
|
|
||||||
GET_METHOD_ID(env, androidcamera->onCameraFree, class, "onCameraFree", "()V");
|
GET_METHOD_ID(env, androidcamera->onCameraFree, class, "onCameraFree", "()V");
|
||||||
if (!androidcamera->onCameraFree)
|
if (!androidcamera->onCameraFree)
|
||||||
return NULL;
|
goto dealloc;
|
||||||
|
|
||||||
GET_METHOD_ID(env, androidcamera->onCameraSetTexture, class, "onCameraSetTexture", "(I)V");
|
GET_METHOD_ID(env, androidcamera->onCameraSetTexture, class, "onCameraSetTexture", "(I)V");
|
||||||
if (!androidcamera->onCameraSetTexture)
|
if (!androidcamera->onCameraSetTexture)
|
||||||
return NULL;
|
goto dealloc;
|
||||||
|
|
||||||
GET_METHOD_ID(env, androidcamera->onCameraStart, class, "onCameraStart", "()V");
|
GET_METHOD_ID(env, androidcamera->onCameraStart, class, "onCameraStart", "()V");
|
||||||
if (!androidcamera->onCameraStart)
|
if (!androidcamera->onCameraStart)
|
||||||
return NULL;
|
goto dealloc;
|
||||||
|
|
||||||
GET_METHOD_ID(env, androidcamera->onCameraStop, class, "onCameraStop", "()V");
|
GET_METHOD_ID(env, androidcamera->onCameraStop, class, "onCameraStop", "()V");
|
||||||
if (!androidcamera->onCameraStop)
|
if (!androidcamera->onCameraStop)
|
||||||
return NULL;
|
goto dealloc;
|
||||||
|
|
||||||
GET_METHOD_ID(env, androidcamera->onCameraPoll, class, "onCameraPoll", "()Z");
|
GET_METHOD_ID(env, androidcamera->onCameraPoll, class, "onCameraPoll", "()Z");
|
||||||
if (!androidcamera->onCameraPoll)
|
if (!androidcamera->onCameraPoll)
|
||||||
return NULL;
|
goto dealloc;
|
||||||
|
|
||||||
CALL_VOID_METHOD(env, android_app->activity->clazz, androidcamera->onCameraInit);
|
CALL_VOID_METHOD(env, android_app->activity->clazz, androidcamera->onCameraInit);
|
||||||
|
|
||||||
return androidcamera;
|
return androidcamera;
|
||||||
|
dealloc:
|
||||||
|
free(androidcamera);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void android_camera_free(void *data)
|
static void android_camera_free(void *data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user