aboutsummaryrefslogtreecommitdiffstats
path: root/src/decrypt.c
diff options
context:
space:
mode:
authorBen Kibbey <[email protected]>2014-10-10 13:02:09 +0000
committerBen Kibbey <[email protected]>2014-10-16 01:34:10 +0000
commitaea2c168fc9c12148181dbcc33d7085aad8e6d90 (patch)
tree0da3de376e89130822b76edef6d935b294a83d87 /src/decrypt.c
parentbuild: Implement SYSROOT feature. (diff)
downloadgpgme-aea2c168fc9c12148181dbcc33d7085aad8e6d90.tar.gz
gpgme-aea2c168fc9c12148181dbcc33d7085aad8e6d90.zip
Add gpgme_set_global_malloc_hooks().
* configure.ac: Remove check for vasprintf(). * doc/gpgme.texi: Add documentation. * src/gpgme.h.in (gpgme_malloc_hooks,gpgme_malloc_hooks_t): New. * src/gpgme.h.in (gpgme_set_global_malloc_hooks): New prototype. * src/mem.c, src/mem.h: New. * src/gpgme.c (gpgme_set_global_malloc_hooks): New. * src/gpgme.def, src/libgpgme.vers: Add gpgme_set_global_malloc_hooks. * src/vasprintf.c (vasprintf): Rename to _gpgme_vasprintf(). * src/vasprintf.c (asprintf): Rename to _gpgme_asprintf(). * src/Makefile.am: Add mem.c, mem.h and vasprintf.c to main_sources. * src/assuan-support.c, src/ath-pthread.c, src/conversion.c, src/data-compat.c, src/data-identify.c, src/data-mem.c, src/data.c, src/debug.c, src/decrypt.c, src/dirinfo.c, src/encrypt.c, src/engine-assuan.c, src/engine-g13.c, src/engine-gpg.c, src/engine-gpgconf.c, src/engine-gpgsm.c, src/engine-spawn.c, src/engine-uiserver.c, src/engine.c, src/export.c, src/genkey.c, src/get-env.c, src/gpgme-w32spawn.c, src/gpgme.c, src/import.c, src/key.c, src/keylist.c, src/op-support.c, src/passphrase.c, src/posix-io.c, src/posix-util.c, src/progress.c, src/setenv.c, src/sig-notation.c, src/sign.c, src/signers.c, src/trust-item.c, src/trustlist.c, src/util.h, src/verify.c, src/version.c, src/vfs-create.c, src/vfs-mount.c, src/w32-ce.c, src/w32-ce.h, src/w32-glib-io.c, src/w32-io.c, src/w32-sema.c, src/w32-util.c, src/wait-global.c, src/wait.c: Change allocation functions: free() to _gpgme_free(), malloc() to _gpgme_malloc(), calloc() to _gpgme_calloc(), realloc() to _gpgme_realloc() and strdup() to _gpgme_strdup(). -- Mostly borrowed from libassuan for custom memory handling. This changes vasprintf.c to implement _gpgme_asprintf() and _gpgme_vasprintf() and will always use the built-in vasprintf() even when provided by the OS.
Diffstat (limited to 'src/decrypt.c')
-rw-r--r--src/decrypt.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/decrypt.c b/src/decrypt.c
index 47420601..40b66e6d 100644
--- a/src/decrypt.c
+++ b/src/decrypt.c
@@ -31,6 +31,7 @@
#include "util.h"
#include "context.h"
#include "ops.h"
+#include "mem.h"
@@ -55,15 +56,15 @@ release_op_data (void *hook)
gpgme_recipient_t recipient = opd->result.recipients;
if (opd->result.unsupported_algorithm)
- free (opd->result.unsupported_algorithm);
+ _gpgme_free (opd->result.unsupported_algorithm);
if (opd->result.file_name)
- free (opd->result.file_name);
+ _gpgme_free (opd->result.file_name);
while (recipient)
{
gpgme_recipient_t next = recipient->next;
- free (recipient);
+ _gpgme_free (recipient);
recipient = next;
}
}
@@ -125,7 +126,7 @@ parse_enc_to (char *args, gpgme_recipient_t *recp, gpgme_protocol_t protocol)
char *tail;
int i;
- rec = malloc (sizeof (*rec));
+ rec = _gpgme_malloc (sizeof (*rec));
if (!rec)
return gpg_error_from_syserror ();
@@ -145,7 +146,7 @@ parse_enc_to (char *args, gpgme_recipient_t *recp, gpgme_protocol_t protocol)
args = &args[i];
if (*args != '\0' && *args != ' ')
{
- free (rec);
+ _gpgme_free (rec);
return trace_gpg_error (GPG_ERR_INV_ENGINE);
}
@@ -159,7 +160,7 @@ parse_enc_to (char *args, gpgme_recipient_t *recp, gpgme_protocol_t protocol)
if (errno || args == tail || *tail != ' ')
{
/* The crypto backend does not behave. */
- free (rec);
+ _gpgme_free (rec);
return trace_gpg_error (GPG_ERR_INV_ENGINE);
}
}
@@ -242,7 +243,7 @@ _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code,
if (!(*args == '?' && *(args + 1) == '\0'))
{
- opd->result.unsupported_algorithm = strdup (args);
+ opd->result.unsupported_algorithm = _gpgme_strdup (args);
if (!opd->result.unsupported_algorithm)
return gpg_error_from_syserror ();
}