summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2017-06-26 17:05:16 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2017-06-26 17:05:16 +0200
commit365a6ee5658fd496d5fc87679de0b583eb3e53b4 (patch)
treefe34cf4f31ab82c8384103bdc7bea01343e827a0
parent134d5d4ff1117e0c81d88b4af1a4358e4bbdf072 (diff)
downloadglibmm-365a6ee5658fd496d5fc87679de0b583eb3e53b4.tar.gz
Gio::TlsDatabase: Fix create_certificate_handle_vfunc()
This vfunc shall delete the returned character array after it has been copied to a Glib::ustring, or else it leaks memory. It shall also convert an empty Glib::ustring to a null gchar*. Bug 783360
-rw-r--r--gio/src/tlsdatabase.hg5
1 files changed, 5 insertions, 0 deletions
diff --git a/gio/src/tlsdatabase.hg b/gio/src/tlsdatabase.hg
index 0be174ac..610402b1 100644
--- a/gio/src/tlsdatabase.hg
+++ b/gio/src/tlsdatabase.hg
@@ -99,7 +99,12 @@ public:
_WRAP_VFUNC(TlsCertificateFlags verify_chain_finish(const Glib::RefPtr<AsyncResult>& result), "verify_chain_finish", errthrow)
+dnl// create_certificate_handle_vfunc() shall return a newly allocated string.
+dnl// Also, ensure that create_certificate_handle_vfunc() never returns an empty char[],
+dnl// because that could be caused by an intermediate empty ustring from an initial null char*.
#m4 _CONVERSION(`GTlsCertificate*',`const Glib::RefPtr<const TlsCertificate>&',`Glib::wrap($3, true)')
+#m4 _CONVERSION(`Glib::ustring',`gchar*',`g_strdup(Glib::c_str_or_nullptr($3))')
+#m4 _CONVERSION(`gchar*',`Glib::ustring',`Glib::convert_return_gchar_ptr_to_ustring($3)')
_WRAP_VFUNC(Glib::ustring create_certificate_handle(const Glib::RefPtr<const TlsCertificate>& certificate) const, "create_certificate_handle")
#m4 _CONVERSION(`Glib::RefPtr<TlsCertificate>',`GTlsCertificate*',`G_TLS_CERTIFICATE(g_object_ref(Glib::unwrap($3)))')