From fa79e8f28ce72fef541d846bfb2340a06509559f Mon Sep 17 00:00:00 2001
From: Chad Hanna <crh184@psu.edu>
Date: Wed, 17 May 2017 12:40:32 -0400
Subject: [PATCH] drop.c move unref to fix potential bug

---
 gstlal/gst/lal/gstlal_drop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gstlal/gst/lal/gstlal_drop.c b/gstlal/gst/lal/gstlal_drop.c
index 44aed777d5..359e6d320c 100644
--- a/gstlal/gst/lal/gstlal_drop.c
+++ b/gstlal/gst/lal/gstlal_drop.c
@@ -167,8 +167,8 @@ static GstFlowReturn chain(GstPad *pad, GstObject *parent, GstBuffer *sinkbuf)
 		result = GST_FLOW_OK;
 	} else if(gst_buffer_get_size(sinkbuf) <= element->drop_samples * element->unit_size) {
 		/* drop entire buffer */
-		gst_buffer_unref(sinkbuf);
 		element->drop_samples -= GST_BUFFER_OFFSET_END(sinkbuf) - GST_BUFFER_OFFSET(sinkbuf);
+		gst_buffer_unref(sinkbuf);
 		element->need_discont = TRUE;
 	} else {
 		/* drop part of buffer, pass the rest */
-- 
GitLab