From 7ae0619cfc6c8d6d30e259022c60c150b8f4318e Mon Sep 17 00:00:00 2001 From: Tomasz Golinski Date: Mon, 15 May 2023 23:57:13 +0200 Subject: [PATCH] Replace g_memdup with safer g_memdup2 g_memdup is declared as deprecated in current GLib, safer replacement g_memdup2 is available since GLib-2.68. Code is protected by GLIB_CHECK_VERSION macro, so should build on older distros as well. See https://docs.gtk.org/glib/func.memdup2.html --- src/exiv2.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/exiv2.cc b/src/exiv2.cc index 305061bc..a2c16c4c 100644 --- a/src/exiv2.cc +++ b/src/exiv2.cc @@ -267,7 +267,11 @@ public: if (cp_data_) { if (data_len) *data_len = cp_length_; +#if GLIB_CHECK_VERSION(2,68,0) + return (unsigned char *) g_memdup2(cp_data_, cp_length_); +#else return (unsigned char *) g_memdup(cp_data_, cp_length_); +#endif } return NULL; } -- 2.20.1