[vlc-devel] commit: Check malloc return value. ( Rémi Duraffort )
git version control
git at videolan.org
Wed Dec 17 21:51:51 CET 2008
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Dec 17 21:40:27 2008 +0100| [7fa3a458a986f9356e81b86c4bdfb99f3f703530] | committer: Rémi Duraffort
Check malloc return value.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7fa3a458a986f9356e81b86c4bdfb99f3f703530
---
modules/access/rtsp/access.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/modules/access/rtsp/access.c b/modules/access/rtsp/access.c
index 9ba74d9..2869c82 100644
--- a/modules/access/rtsp/access.c
+++ b/modules/access/rtsp/access.c
@@ -155,7 +155,7 @@ static int Open( vlc_object_t *p_this )
{
access_t *p_access = (access_t *)p_this;
access_sys_t *p_sys;
- char *psz_server = 0;
+ char* psz_server = NULL;
int i_result;
if( !p_access->psz_access || (
@@ -177,7 +177,14 @@ static int Open( vlc_object_t *p_this )
p_access->info.i_title = 0;
p_access->info.i_seekpoint = 0;
p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
+ if( !p_sys )
+ return VLC_ENOMEM;
p_sys->p_rtsp = malloc( sizeof( rtsp_client_t) );
+ if( !p_sys->p_rtsp )
+ {
+ free( p_sys );
+ return VLC_ENOMEM;
+ }
p_sys->p_header = NULL;
p_sys->p_rtsp->p_userdata = p_access;
More information about the vlc-devel
mailing list