Mercurial > mplayer.hg
comparison stream/stream_ftp.c @ 35338:4fe8922d6242
stream ftp: Create buffers before opening control connection
author | al |
---|---|
date | Tue, 20 Nov 2012 22:22:04 +0000 |
parents | 6641819c8f45 |
children | c7c59b8e3af8 |
comparison
equal
deleted
inserted
replaced
35337:6641819c8f45 | 35338:4fe8922d6242 |
---|---|
428 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] Bad url\n"); | 428 mp_msg(MSGT_OPEN,MSGL_ERR, "[ftp] Bad url\n"); |
429 m_struct_free(&stream_opts,opts); | 429 m_struct_free(&stream_opts,opts); |
430 return STREAM_ERROR; | 430 return STREAM_ERROR; |
431 } | 431 } |
432 | 432 |
433 // Allocate buffers | |
434 p->buf = malloc(BUFSIZE); | |
435 | |
436 if (!p->buf) { | |
437 close_f(stream); | |
438 m_struct_free(&stream_opts,opts); | |
439 return STREAM_ERROR; | |
440 } | |
441 | |
433 // Open the control connection | 442 // Open the control connection |
434 p->handle = connect2Server(p->host,p->port,1); | 443 p->handle = connect2Server(p->host,p->port,1); |
435 | 444 |
436 if(p->handle < 0) { | 445 if(p->handle < 0) { |
437 m_struct_free(&stream_opts,opts); | 446 m_struct_free(&stream_opts,opts); |
439 } | 448 } |
440 | 449 |
441 // We got a connection, let's start serious things | 450 // We got a connection, let's start serious things |
442 stream->fd = -1; | 451 stream->fd = -1; |
443 stream->priv = p; | 452 stream->priv = p; |
444 p->buf = malloc(BUFSIZE); | |
445 | 453 |
446 if (readresp(p, NULL) == 0) { | 454 if (readresp(p, NULL) == 0) { |
447 close_f(stream); | 455 close_f(stream); |
448 m_struct_free(&stream_opts,opts); | 456 m_struct_free(&stream_opts,opts); |
449 return STREAM_ERROR; | 457 return STREAM_ERROR; |