diff --git a/gst/encoding/gstencodebin.c b/gst/encoding/gstencodebin.c
index c1a0e8bbc0..51b93ce9a8 100644
--- a/gst/encoding/gstencodebin.c
+++ b/gst/encoding/gstencodebin.c
@@ -1698,9 +1698,9 @@ gst_encode_bin_set_profile (GstEncodeBin * ebin, GstEncodingProfile * profile)
   }
 
   /* If we're not active, we can deactivate the previous profile */
-  if (ebin->profile)
-    gst_encoding_profile_unref (ebin->profile);
-  ebin->profile = NULL;
+  if (ebin->profile) {
+    gst_encode_bin_tear_down_profile (ebin);
+  }
 
   return gst_encode_bin_setup_profile (ebin, profile);
 }