freeing char pointer of libvlc_video_get_aspect_ratio

This forum is about all development around libVLC.
devildrey33
Blank Cone
Blank Cone
Posts: 11
Joined: 07 Dec 2010 17:06
Operating System: Windows & Linux
Location: Spain

freeing char pointer of libvlc_video_get_aspect_ratio

Postby devildrey33 » 11 Dec 2011 21:38

Hi im using libvlc_video_get_aspect_ratio to determine if user has selected a special aspect ratio on current video.

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));
I dont have access to libvlc core functions and can't try libvlc_free() to release these pointer.

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; }
Assertion callstack points to "free(Prop);"

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.
http://www.devildrey33.es

Rémi Denis-Courmont
Developer
Developer
Posts: 15213
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: freeing char pointer of libvlc_video_get_aspect_ratio

Postby Rémi Denis-Courmont » 12 Dec 2011 08:01

With Visual Studio, you need to use libvlc_free().
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 6 guests