sparsefile: small cleanup
authorWim Taymans <wtaymans@redhat.com>
Mon, 11 May 2015 08:52:23 +0000 (10:52 +0200)
committerWim Taymans <wtaymans@redhat.com>
Mon, 18 May 2015 09:26:07 +0000 (11:26 +0200)
The error path unrefs file->file so make sure we only go there when
there is a non-NULL file->file.

plugins/elements/gstsparsefile.c

index fb9b26c..b8a0577 100644 (file)
@@ -343,13 +343,12 @@ gst_sparse_file_read (GstSparseFile * file, gsize offset, gpointer data,
         goto error;
     }
     res = fread (data, 1, count, file->file);
+    if (G_UNLIKELY (res < count))
+      goto error;
   }
 
   file->current_pos = offset + res;
 
-  if (G_UNLIKELY (res < count))
-    goto error;
-
   if (remaining)
     *remaining = range->stop - file->current_pos;