Commit cdab2dbf authored by Philippe Morin's avatar Philippe Morin

Add input check.

Avoid mallocing/freeing a libvlc_exception_t (end).
parent 2f29e4ff
......@@ -54,9 +54,9 @@ JNIEXPORT jlong JNICALL Java_org_videolan_jvlc_JVLC_createInstance (JNIEnv *env,
int argc;
const char **argv;
libvlc_exception_t *exception = ( libvlc_exception_t * ) malloc( sizeof( libvlc_exception_t ) );
libvlc_exception_t exception;
libvlc_exception_init( exception );
libvlc_exception_init( &exception );
argc = (int) env->GetArrayLength((jarray) args);
argv = (const char **) malloc(argc * sizeof(char*));
......@@ -67,9 +67,9 @@ JNIEXPORT jlong JNICALL Java_org_videolan_jvlc_JVLC_createInstance (JNIEnv *env,
);
}
res = (long) libvlc_new(argc, (char**) argv, exception );
free( exception );
res = (long) libvlc_new(argc, (char**) argv, &exception );
CHECK_EXCEPTION ;
return res;
......
......@@ -24,9 +24,7 @@
*****************************************************************************/
#include <jni.h>
#include <vlc/libvlc.h>
/* JVLC internal imports, generated by gcjh */
#include "../includes/Input.h"
#include "utils.h"
......@@ -117,7 +115,11 @@ JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Input__1isPlaying (JNIEnv *env
vlc_bool_t res = 0;
GET_INPUT_THREAD ;
if (input == NULL) {
return false;
}
res = libvlc_media_instance_will_play( input, &exception );
libvlc_media_instance_release(input);
CHECK_EXCEPTION ;
......@@ -132,6 +134,9 @@ JNIEXPORT jboolean JNICALL Java_org_videolan_jvlc_Input__1hasVout (JNIEnv *env,
GET_INPUT_THREAD ;
if (input == NULL) {
return false;
}
res = libvlc_media_instance_has_vout( input, &exception );
libvlc_media_instance_release(input);
CHECK_EXCEPTION ;
......
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