From 6b72c1b0aafc1733a7fcb6f6c722338a625bdfd9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sat, 21 Mar 2009 19:55:16 +0200 Subject: [PATCH] dshow: remove dangerous alloca, fix charset and and invalid free Invalid free pointed out by xxcv. --- modules/access/dshow/dshow.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp index a12a76c348..6aa83b9087 100644 --- a/modules/access/dshow/dshow.cpp +++ b/modules/access/dshow/dshow.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include "common.h" #include "filter.h" @@ -1205,16 +1206,8 @@ FindCaptureDevice( vlc_object_t *p_this, string *p_devicename, p_bag->Release(); if( SUCCEEDED(hr) ) { - int i_convert = WideCharToMultiByte(CP_ACP, 0, 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'; - + char *p_buf = FromWide( var.bstrVal ); string devname = string(p_buf); - free( p_buf) ; int dup = 0; -- 2.39.2