[glibmm] Gio::TlsDatabase: Fix create_certificate_handle_vfunc()
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Gio::TlsDatabase: Fix create_certificate_handle_vfunc()
- Date: Mon, 26 Jun 2017 15:08:02 +0000 (UTC)
commit 365a6ee5658fd496d5fc87679de0b583eb3e53b4
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Mon Jun 26 17:05:16 2017 +0200
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
gio/src/tlsdatabase.hg | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gio/src/tlsdatabase.hg b/gio/src/tlsdatabase.hg
index 0be174a..610402b 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)))')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]