[vlc-devel] commit: Avoid alloca() ( Rémi Denis-Courmont )

git version control git at videolan.org
Fri Apr 10 20:17:01 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Apr 10 21:15:18 2009 +0300| [4496957d9f48e1fb618e01112fee08e7a95739f9] | committer: Rémi Denis-Courmont 

Avoid alloca()

By the way, alloca() _cannot_ return NULL. It simply crashes if there
is not enough memory.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4496957d9f48e1fb618e01112fee08e7a95739f9
---

 projects/activex/persiststreaminit.cpp |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/projects/activex/persiststreaminit.cpp b/projects/activex/persiststreaminit.cpp
index 0660566..2ec4adb 100644
--- a/projects/activex/persiststreaminit.cpp
+++ b/projects/activex/persiststreaminit.cpp
@@ -417,9 +417,7 @@ private:
         if( 0 == len )
             return E_INVALIDARG;
 
-        LPWSTR propName = (LPOLESTR)::alloca((len+1)*sizeof(WCHAR));
-        if( NULL == propName )
-            return E_OUTOFMEMORY;
+        WCHAR propName[len + 1];
 
         result = pStm->Read(propName, len*sizeof(WCHAR), NULL);
         if( FAILED(result) )




More information about the vlc-devel mailing list