diff options
author | Juan Navarro <juan.navarro@gmx.es> | 2019-06-25 20:37:38 +0200 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2019-08-09 19:14:43 +0100 |
commit | 93d311867c8a25d9ea505b9feba298bc0f221171 (patch) | |
tree | 2c0f6b7ce495d9d8d6c51f159e9cb1ac08f17c71 /ext | |
parent | 9b0c528e0262480fe0d751c1eb9810185bf4ca4f (diff) | |
download | gstreamer-plugins-bad-93d311867c8a25d9ea505b9feba298bc0f221171.tar.gz |
dtlsdec: Avoid duplicate ref when passing certificate property
The agent itself will take a ref on the property setter, so we'll be
left with two references to the certificate object, when actually there
should be only one
Diffstat (limited to 'ext')
-rw-r--r-- | ext/dtls/gstdtlsdec.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/ext/dtls/gstdtlsdec.c b/ext/dtls/gstdtlsdec.c index 87b822131..e41914ee5 100644 --- a/ext/dtls/gstdtlsdec.c +++ b/ext/dtls/gstdtlsdec.c @@ -587,9 +587,12 @@ get_agent_by_pem (const gchar * pem) if (!pem) { if (g_once_init_enter (&generated_cert_agent)) { GstDtlsAgent *new_agent; + GObject *certificate; + certificate = g_object_new (GST_TYPE_DTLS_CERTIFICATE, NULL); new_agent = g_object_new (GST_TYPE_DTLS_AGENT, "certificate", - g_object_new (GST_TYPE_DTLS_CERTIFICATE, NULL), NULL); + certificate, NULL); + g_object_unref (certificate); GST_DEBUG_OBJECT (generated_cert_agent, "no agent with generated cert found, creating new"); @@ -612,9 +615,12 @@ get_agent_by_pem (const gchar * pem) agent = GST_DTLS_AGENT (g_hash_table_lookup (agent_table, pem)); if (!agent) { - agent = g_object_new (GST_TYPE_DTLS_AGENT, - "certificate", g_object_new (GST_TYPE_DTLS_CERTIFICATE, "pem", pem, - NULL), NULL); + GObject *certificate; + + certificate = g_object_new (GST_TYPE_DTLS_CERTIFICATE, "pem", pem, NULL); + agent = g_object_new (GST_TYPE_DTLS_AGENT, "certificate", certificate, + NULL); + g_object_unref (certificate); g_object_weak_ref (G_OBJECT (agent), (GWeakNotify) agent_weak_ref_notify, (gpointer) g_strdup (pem)); |