Commit 6b72c1b0 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Rémi Denis-Courmont

dshow: remove dangerous alloca, fix charset and and invalid free

Invalid free pointed out by xxcv.
parent 1be9f953
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <vlc_demux.h> #include <vlc_demux.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_dialog.h> #include <vlc_dialog.h>
#include <vlc_charset.h>
#include "common.h" #include "common.h"
#include "filter.h" #include "filter.h"
...@@ -1205,16 +1206,8 @@ FindCaptureDevice( vlc_object_t *p_this, string *p_devicename, ...@@ -1205,16 +1206,8 @@ FindCaptureDevice( vlc_object_t *p_this, string *p_devicename,
p_bag->Release(); p_bag->Release();
if( SUCCEEDED(hr) ) if( SUCCEEDED(hr) )
{ {
int i_convert = WideCharToMultiByte(CP_ACP, 0, var.bstrVal, char *p_buf = FromWide( var.bstrVal );
SysStringLen(var.bstrVal), NULL, 0, NULL, NULL);
char *p_buf = (char *)alloca( i_convert+1 ); p_buf[0] = 0;
WideCharToMultiByte( CP_ACP, 0, var.bstrVal,
SysStringLen(var.bstrVal), p_buf, i_convert, NULL, NULL );
SysFreeString(var.bstrVal);
p_buf[i_convert] = '\0';
string devname = string(p_buf); string devname = string(p_buf);
free( p_buf) ; free( p_buf) ;
int dup = 0; int dup = 0;
......
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