aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpgme-w32spawn.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/gpgme-w32spawn.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/gpgme-w32spawn.c')
-rw-r--r--src/gpgme-w32spawn.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gpgme-w32spawn.c b/src/gpgme-w32spawn.c
index b510ba3a..20b62136 100644
--- a/src/gpgme-w32spawn.c
+++ b/src/gpgme-w32spawn.c
@@ -77,7 +77,7 @@ build_commandline (char **argv)
/* And a trailing zero. */
n++;
- buf = p = malloc (n);
+ buf = p = _gpgme_malloc (n);
if (!buf)
return NULL;
for (i = 0; argv[i]; i++)
@@ -188,7 +188,7 @@ my_spawn (char **argv, struct spawn_fd_item_s *fd_list, unsigned int flags)
NULL);
if (hnul == INVALID_HANDLE_VALUE)
{
- free (arg_string);
+ _gpgme_free (arg_string);
/* FIXME: Should translate the error code. */
errno = EIO;
return -1;
@@ -217,13 +217,13 @@ my_spawn (char **argv, struct spawn_fd_item_s *fd_list, unsigned int flags)
&si, /* startup information */
&pi)) /* returns process information */
{
- free (arg_string);
+ _gpgme_free (arg_string);
/* FIXME: Should translate the error code. */
errno = EIO;
return -1;
}
- free (arg_string);
+ _gpgme_free (arg_string);
/* Close the /dev/nul handle if used. */
if (hnul != INVALID_HANDLE_VALUE)
@@ -399,10 +399,10 @@ translate_handles (const char *trans_file, const char * const *argv,
for (idx = 0; argv[idx]; idx++)
;
- args = malloc (sizeof (*args) * (idx + 1));
+ args = _gpgme_malloc (sizeof (*args) * (idx + 1));
for (idx = 0; argv[idx]; idx++)
{
- args[idx] = strdup (argv[idx]);
+ args[idx] = _gpgme_strdup (argv[idx]);
if (!args[idx])
return NULL;
}
@@ -424,7 +424,7 @@ translate_handles (const char *trans_file, const char * const *argv,
return NULL;
}
- args[aidx] = malloc (sizeof (buf));
+ args[aidx] = _gpgme_malloc (sizeof (buf));
/* We currently disable translation for stdin/stdout/stderr. We
assume that the spawned program handles 0/1/2 specially
already. FIXME: Check if this is true. */