sparsefile: fix possible crash when seeking
authordhilshad <mohddhilshadm@gmail.com>
Sat, 15 Feb 2020 16:50:18 +0000 (22:20 +0530)
committerSebastian Dröge <slomo@coaxion.net>
Mon, 25 May 2020 08:35:32 +0000 (08:35 +0000)
In gst_sparse_file_clear function we were closing a file and
reopening it using closed file descriptor.

Fix: Removed closing and reopening of file.

Fixes #512

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/372>

plugins/elements/gstsparsefile.c

index 0ff6b16b6601c193bd22fe733c67ef5796a66e32..a88344a7b14a4900c536728b4acf6684f1160c72 100644 (file)
@@ -191,10 +191,6 @@ gst_sparse_file_clear (GstSparseFile * file)
 {
   g_return_if_fail (file != NULL);
 
-  if (file->file) {
-    fclose (file->file);
-    file->file = fdopen (file->fd, "wb+");
-  }
   g_slice_free_chain (GstSparseRange, file->ranges, next);
   file->current_pos = 0;
   file->ranges = NULL;