[Pkg-gnupg-commit] [gpgme] 27/132: qt: Don't use qstrdup in test passphrase cb

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Apr 26 01:01:17 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gpgme.

commit a09ed3f26a1fab54079c37c49df5c440cc792f78
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Jan 12 11:44:11 2017 +0100

    qt: Don't use qstrdup in test passphrase cb
    
    * lang/qt/tests/t-support.h (TestPassphraseProvider::getPassphrase):
    Use gpgrt_asprintf instead of strdup.
    
    --
    To avoid problems on MacOS we want to avoid strdup so that
    qgpgme can be built without extensions. But qstrdup allocates
    with new and not with malloc, so use gpgrt_asprintf instead.
---
 lang/qt/tests/t-support.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lang/qt/tests/t-support.h b/lang/qt/tests/t-support.h
index 2630b7d..e3f0e78 100644
--- a/lang/qt/tests/t-support.h
+++ b/lang/qt/tests/t-support.h
@@ -34,6 +34,8 @@
 #include "interfaces/passphraseprovider.h"
 #include <QObject>
 
+#include <gpg-error.h>
+
 namespace GpgME
 {
 class TestPassphraseProvider : public PassphraseProvider
@@ -42,7 +44,9 @@ public:
     char *getPassphrase(const char * /*useridHint*/, const char * /*description*/,
                         bool /*previousWasBad*/, bool &/*canceled*/) Q_DECL_OVERRIDE
     {
-        return qstrdup("abc");
+        char *ret;
+        gpgrt_asprintf(&ret, "abc");
+        return ret;
     }
 };
 } // namespace GpgME

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list