summaryrefslogtreecommitdiff
path: root/libavformat/ftp.c
diff options
context:
space:
mode:
authorAlexander Strasser <eclipse7@gmx.net>2014-08-20 00:41:55 +0200
committerAlexander Strasser <eclipse7@gmx.net>2014-08-26 00:52:29 +0200
commitdb85d11d9d880c932b13d37b5f1ca2bc9e3a253b (patch)
tree1f5f3689acdbfa39dc5f8b73a343038acd53b9f9 /libavformat/ftp.c
parentf75baa6c9b1784866f3ecd7ec2ee223644c38e7b (diff)
downloadffmpeg-db85d11d9d880c932b13d37b5f1ca2bc9e3a253b.tar.gz
libavformat/ftp: Do not leak memory in routine ftp_features
Setting the pointer to NULL inside both ftp_send_command and ftp_features is redundant. Generally always setting to NULL in ftp_send_command seems safer, but throughout the file that parameter was always passed initialized. So I do it here too for consistency. Should fix CID1231988 (RESOURCE_LEAK) OKed-by: Lukasz Marek <lukasz.m.luki2@gmail.com> Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
Diffstat (limited to 'libavformat/ftp.c')
-rw-r--r--libavformat/ftp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 9ee9b1630f..7faf4a5d66 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -183,6 +183,9 @@ static int ftp_send_command(FTPContext *s, const char *command,
{
int err;
+ if (response)
+ *response = NULL;
+
if ((err = ffurl_write(s->conn_control, command, strlen(command))) < 0)
return err;
if (!err)
@@ -444,12 +447,14 @@ static int ftp_features(FTPContext *s)
static const char *enable_utf8_command = "OPTS UTF8 ON\r\n";
static const int feat_codes[] = {211, 0};
static const int opts_codes[] = {200, 451};
- char *feat;
+ char *feat = NULL;
if (ftp_send_command(s, feat_command, feat_codes, &feat) == 211) {
if (av_stristr(feat, "UTF8"))
ftp_send_command(s, enable_utf8_command, opts_codes, NULL);
}
+ av_freep(&feat);
+
return 0;
}