]> git.sesse.net Git - vlc/commitdiff
* net: mem leak in net_Printf
authorLaurent Aimar <fenrir@videolan.org>
Wed, 7 Jan 2004 14:59:03 +0000 (14:59 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 7 Jan 2004 14:59:03 +0000 (14:59 +0000)
src/misc/net.c

index c0781e6a713564aeef772e89e4dbf90aea1a48ac..e7eb060453b50d9cf6b69bf14af342642a08ca32 100644 (file)
@@ -2,7 +2,7 @@
  * net.c:
  *****************************************************************************
  * Copyright (C) 2004 VideoLAN
- * $Id: net.c,v 1.2 2004/01/06 23:03:17 fenrir Exp $
+ * $Id: net.c,v 1.3 2004/01/07 14:59:03 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@videolan.org>
  *
@@ -320,7 +320,7 @@ int net_Printf( vlc_object_t *p_this, int fd, char *psz_fmt, ... )
 {
     va_list args;
     char    *psz;
-    int     i_size;
+    int     i_size, i_ret;
 
     va_start( args, psz_fmt );
     psz = vsprintf_m( psz_fmt, args );
@@ -328,7 +328,10 @@ int net_Printf( vlc_object_t *p_this, int fd, char *psz_fmt, ... )
 
     i_size = strlen( psz );
 
-    return __net_Write( p_this, fd, psz, i_size ) < i_size ? -1 : i_size;
+    i_ret = __net_Write( p_this, fd, psz, i_size ) < i_size ? -1 : i_size;
+    free( psz );
+
+    return i_ret;
 }