diff --git a/plugins/elements/gstsparsefile.c b/plugins/elements/gstsparsefile.c index fb9b26cfe2..b8a0577d81 100644 --- a/plugins/elements/gstsparsefile.c +++ b/plugins/elements/gstsparsefile.c @@ -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;