From c808759709c9eb4e3bd1bb5320e2493a684d1cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Thu, 14 Jan 2021 14:15:17 +0100 Subject: [PATCH] gst free error only if occurs. --- internal/capture/gst/gst.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/capture/gst/gst.go b/internal/capture/gst/gst.go index 31b9e504..d14711ef 100644 --- a/internal/capture/gst/gst.go +++ b/internal/capture/gst/gst.go @@ -172,9 +172,9 @@ func CreatePipeline(pipelineStr string, clockRate float32) (*Pipeline, error) { var gstError *C.GError gstPipeline = C.gst_parse_launch(pipelineStrUnsafe, &gstError) - defer C.g_error_free(gstError) if gstError != nil { + defer C.g_error_free(gstError) return nil, fmt.Errorf("(pipeline error) %s", C.GoString(gstError.message)) }