[vlc-devel] commit: Fix potential memleak (+cleaning). ( Rémi Duraffort )
git version control
git at videolan.org
Fri Oct 31 23:50:04 CET 2008
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Oct 31 23:49:48 2008 +0100| [ce9b3ea8e724dc6f36c9a84ccacc56fa354bde60] | committer: Rémi Duraffort
Fix potential memleak (+cleaning).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ce9b3ea8e724dc6f36c9a84ccacc56fa354bde60
---
modules/access/tcp.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/modules/access/tcp.c b/modules/access/tcp.c
index e346686..d3ea47e 100644
--- a/modules/access/tcp.c
+++ b/modules/access/tcp.c
@@ -102,10 +102,14 @@ static int Open( vlc_object_t *p_this )
*psz_parser++ = '\0';
/* Init p_access */
- access_InitFields( p_access ); \
- ACCESS_SET_CALLBACKS( Read, NULL, Control, NULL ); \
- MALLOC_ERR( p_access->p_sys, access_sys_t ); \
- p_sys = p_access->p_sys; memset( p_sys, 0, sizeof( access_sys_t ) );
+ access_InitFields( p_access );
+ ACCESS_SET_CALLBACKS( Read, NULL, Control, NULL );
+ p_sys = p_access->p_sys = calloc( 1, sizeof( access_sys_t ) );
+ if( !p_sys )
+ {
+ free( psz_dup );
+ return VLC_ENOMEM;
+ }
p_sys->fd = net_ConnectTCP( p_access, psz_dup, atoi( psz_parser ) );
free( psz_dup );
More information about the vlc-devel
mailing list