Commit 56c7f073 authored by Rafaël Carré's avatar Rafaël Carré

aout: Delete local reference even if global referencing failed

http://java.sun.com/docs/books/jni/html/refs.html
parent 35da541a
...@@ -89,15 +89,14 @@ int aout_open(void **opaque, char *format, unsigned *rate, unsigned *nb_channels ...@@ -89,15 +89,14 @@ int aout_open(void **opaque, char *format, unsigned *rate, unsigned *nb_channels
/* Use a global reference to not reallocate memory each time we run /* Use a global reference to not reallocate memory each time we run
the play function. */ the play function. */
p_sys->buffer = (*p_env)->NewGlobalRef (p_env, buffer); p_sys->buffer = (*p_env)->NewGlobalRef (p_env, buffer);
/* The local reference is no longer useful. */
(*p_env)->DeleteLocalRef (p_env, buffer);
if (p_sys->buffer == NULL) if (p_sys->buffer == NULL)
{ {
LOGE ("Couldn't create the global reference!"); LOGE ("Couldn't create the global reference!");
goto error; goto error;
} }
/* The local reference is no longer useful. */
(*p_env)->DeleteLocalRef (p_env, buffer);
// Get the play methodId // Get the play methodId
p_sys->play = (*p_env)->GetMethodID (p_env, cls, "playAudio", "([BI)V"); p_sys->play = (*p_env)->GetMethodID (p_env, cls, "playAudio", "([BI)V");
assert (p_sys->play != NULL); assert (p_sys->play != NULL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment