These function returns a pointer to a char, and on documentation ive readed that pointer needs to be released using free() or libvlc_free(). But when i try to release these pointer with free() function i get an assertion on the next line of visual studio crt (NOTE i only try to release these pointer when it not returns NULL, for example returns "16:9"):
Code: Select all
/*
* If this ASSERT fails, a bad pointer has been passed in. It may be
* totally bogus, or it may have been allocated from another heap.
* The pointer MUST come from the 'local' heap.
*/
_ASSERTE(_CrtIsValidHeapPointer(pUserData));
This is my function :
Code: Select all
const unsigned int SistemaVLC::Proporcion(void) {
char *Prop = NULL;
int Ret = 0;
if (_MediaPlayer != NULL) {
Prop = libvlc_video_get_aspect_ratio(_MediaPlayer);
if (Prop == NULL) return IDMV_PROP_PREDETERMINADA;
if (strcmp(Prop, "1:1") == 0) Ret = IDMV_PROP_1_1;
if (strcmp(Prop, "4:3") == 0) Ret = IDMV_PROP_4_3;
if (strcmp(Prop, "16:9") == 0) Ret = IDMV_PROP_16_9;
if (strcmp(Prop, "16:10") == 0) Ret = IDMV_PROP_16_10;
if (strcmp(Prop, "2.21:1") == 0) Ret = IDMV_PROP_221_1;
if (strcmp(Prop, "2.35:1") == 0) Ret = IDMV_PROP_235_1;
if (strcmp(Prop, "2.39:1") == 0) Ret = IDMV_PROP_239_1;
if (strcmp(Prop, "5:4") == 0) Ret = IDMV_PROP_5_4;
// En la documentacion dice que hay que liberar lo que devuelva libvlc_video_get_aspect_ratio con free() o libvlc_free()
// Como no tenngo acceso a las funciones del core he probado la funcion free(), y esta provoca un error
free(Prop);
}
return Ret;
}
I tried libvlc 1.1.5 and 1.1.12 on windows 7 with visual studio, and i run libvlc functions from same thread always.
Anny suggestions?
Thanks in advance for your time, and sorry for my poor english.