]> granicus.if.org Git - handbrake/commitdiff
stream: fix memory leak during PS stream probe
authorJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 20 Apr 2016 20:20:18 +0000 (14:20 -0600)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 20 Apr 2016 20:20:45 +0000 (14:20 -0600)
libhb/stream.c

index 37edd62d39ee246773a72768b40c95b068a13773..5fa0dda439ecb828e25482a7df5947f70e22ce74 100644 (file)
@@ -4340,13 +4340,19 @@ static void hb_ps_resolve_stream_types(hb_stream_t *stream)
         total_size += buf->size;
 
         if ( total_size > HB_MAX_PROBE_SIZE * 2 )
+        {
+            hb_buffer_close(&buf);
             break;
+        }
 
         int idx;
         idx = index_of_id( stream, buf->s.id );
 
         if (idx < 0 || stream->pes.list[idx].stream_kind != U )
+        {
+            hb_buffer_close(&buf);
             continue;
+        }
 
         hb_pes_stream_t *pes = &stream->pes.list[idx];
 
@@ -4364,6 +4370,7 @@ static void hb_ps_resolve_stream_types(hb_stream_t *stream)
                         pes->codec_name, pes->stream_id, pes->stream_id_ext);
             }
         }
+        hb_buffer_close(&buf);
     }
     // Clean up any probe buffers and set all remaining unknown
     // streams to 'kind' N