aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine-gpg.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2017-02-02 11:35:59 +0000
committerWerner Koch <[email protected]>2017-02-02 11:35:59 +0000
commit15050ce5fce4ed815503db7c029abb38d08970d6 (patch)
treed0c58db0e44d9f94c2655845482027b678918819 /src/engine-gpg.c
parentcore: Remove unused check for funopen/fopencookie. (diff)
downloadgpgme-15050ce5fce4ed815503db7c029abb38d08970d6.tar.gz
gpgme-15050ce5fce4ed815503db7c029abb38d08970d6.zip
core: Replace all calls to *sprintf by gpgrt_*sprintf.
* configure.ac (vasprintf): Remove check. * src/vasprintf.c: Remove file. * src/util.h (vasprintf, asprintf): Remove prototypes. Replace all calls to vasprintf and asprintf by gpgrt_vasprintf or gpgrt_asprintf. Also take care to use gpgrt_free on the returned value. * src/w32-util.c (_gpgme_get_gpgconf_path): Replace a gpgrt_asprintf by _gpgme_strconcat. (snprintf): New macro to use gpgrt_snprintf instead of the system's standard snprintf. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/engine-gpg.c')
-rw-r--r--src/engine-gpg.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 75ba4bdb..21ca02a8 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -74,6 +74,10 @@ struct fd_data_map_s
};
+/* NB.: R_LINE is allocated an gpgrt function and thus gpgrt_free
+ * shall be used to release it. This takes care of custom memory
+ * allocators and avoids problems on Windows with different runtimes
+ * used for libgpg-error/gpgrt and gpgme. */
typedef gpgme_error_t (*colon_preprocessor_t) (char *line, char **rline);
struct engine_gpg
@@ -1346,7 +1350,7 @@ read_colon_line (engine_gpg_t gpg)
}
while (linep && *linep);
- free (line);
+ gpgrt_free (line);
}
else
gpg->colon.fnc (gpg->colon.fnc_value, buffer);
@@ -2513,7 +2517,7 @@ gpg_keylist_preprocess (char *line, char **r_line)
n = strlen (field[1]);
if (n > 16)
{
- if (asprintf (r_line,
+ if (gpgrt_asprintf (r_line,
"pub:o%s:%s:%s:%s:%s:%s::::::::\n"
"fpr:::::::::%s:",
field[6], field[3], field[2], field[1] + n - 16,
@@ -2522,7 +2526,7 @@ gpg_keylist_preprocess (char *line, char **r_line)
}
else
{
- if (asprintf (r_line,
+ if (gpgrt_asprintf (r_line,
"pub:o%s:%s:%s:%s:%s:%s::::::::",
field[6], field[3], field[2], field[1],
field[4], field[5]) < 0)
@@ -2580,7 +2584,7 @@ gpg_keylist_preprocess (char *line, char **r_line)
}
*dst = '\0';
- if (asprintf (r_line, "uid:o%s::::%s:%s:::%s:",
+ if (gpgrt_asprintf (r_line, "uid:o%s::::%s:%s:::%s:",
field[4], field[2], field[3], uid) < 0)
return gpg_error_from_syserror ();
}