diff options
author | Andre Heinecke <[email protected]> | 2017-01-12 10:44:11 +0000 |
---|---|---|
committer | Andre Heinecke <[email protected]> | 2017-01-12 10:44:11 +0000 |
commit | a09ed3f26a1fab54079c37c49df5c440cc792f78 (patch) | |
tree | 7988a75b1bf66a019929fca607292b96ac616b77 | |
parent | qt: Clean up test dirs on failure (diff) | |
download | gpgme-a09ed3f26a1fab54079c37c49df5c440cc792f78.tar.gz gpgme-a09ed3f26a1fab54079c37c49df5c440cc792f78.zip |
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.
-rw-r--r-- | lang/qt/tests/t-support.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lang/qt/tests/t-support.h b/lang/qt/tests/t-support.h index 2630b7d4..e3f0e781 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 |