lavf/ftp: fix possible crash
authorLukasz Marek <lukasz.m.luki@gmail.com>
Wed, 28 Aug 2013 23:54:04 +0000 (01:54 +0200)
committerLukasz Marek <lukasz.m.luki@gmail.com>
Wed, 28 Aug 2013 23:57:38 +0000 (01:57 +0200)
libavformat/ftp.c

index c73319d..eb3827f 100644 (file)
@@ -128,7 +128,8 @@ static int ftp_status(FTPContext *s, char **line, const int response_codes[])
 
     while (!code_found || dash) {
         if ((err = ftp_get_line(s, buf, sizeof(buf))) < 0) {
 
     while (!code_found || dash) {
         if ((err = ftp_get_line(s, buf, sizeof(buf))) < 0) {
-            av_bprint_finalize(&line_buffer, NULL);
+            if (line)
+                av_bprint_finalize(&line_buffer, NULL);
             return err;
         }
 
             return err;
         }