[MPlayer-cvslog] r35432 - trunk/stream/stream_ftp.c

al subversion at mplayerhq.hu
Tue Nov 20 23:22:04 CET 2012


Author: al
Date: Tue Nov 20 23:22:04 2012
New Revision: 35432

Log:
stream ftp: Create buffers before opening control connection

Modified:
   trunk/stream/stream_ftp.c

Modified: trunk/stream/stream_ftp.c
==============================================================================
--- trunk/stream/stream_ftp.c	Tue Nov 20 23:20:52 2012	(r35431)
+++ trunk/stream/stream_ftp.c	Tue Nov 20 23:22:04 2012	(r35432)
@@ -430,6 +430,15 @@ static int open_f(stream_t *stream,int m
     return STREAM_ERROR;
   }
 
+  // Allocate buffers
+  p->buf = malloc(BUFSIZE);
+
+  if (!p->buf) {
+    close_f(stream);
+    m_struct_free(&stream_opts,opts);
+    return STREAM_ERROR;
+  }
+
   // Open the control connection
   p->handle = connect2Server(p->host,p->port,1);
 
@@ -441,7 +450,6 @@ static int open_f(stream_t *stream,int m
   // We got a connection, let's start serious things
   stream->fd = -1;
   stream->priv = p;
-  p->buf = malloc(BUFSIZE);
 
   if (readresp(p, NULL) == 0) {
     close_f(stream);


More information about the MPlayer-cvslog mailing list