summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-03-24 10:41:22 +0100
committerPeter Wu <peter@lekensteyn.nl>2016-03-24 13:54:06 +0100
commitd18fc77286cc10343220d8ea012cfe32ea190a0d (patch)
tree4d53f92f02aadf05ccba48378916e08ca3ddd5d3
parent518d2335e09f989d1e8092019ce9410dd4d3427c (diff)
downloadlibgcrypt-memleak-fixes.tar.gz
Mark constant MPIs as non-leakedmemleak-fixes
* mpi/mpiutil.c: Mark "constant" MPIs as explicitly leaked. -- Requires libgpg-error 1.22 (unreleased) for the macros, but since it is a minor debugging aid, do not bump the minimum required version. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--mpi/mpiutil.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/mpi/mpiutil.c b/mpi/mpiutil.c
index 99402b82..142c74e0 100644
--- a/mpi/mpiutil.c
+++ b/mpi/mpiutil.c
@@ -61,7 +61,7 @@ _gcry_mpi_init (void)
default: log_bug ("invalid mpi_const selector %d\n", idx);
}
constants[idx] = mpi_alloc_set_ui (value);
- constants[idx]->flags = (16|32);
+ _gcry_mpi_set_flag(constants[idx], GCRYMPI_FLAG_CONST);
}
return 0;
@@ -665,7 +665,12 @@ _gcry_mpi_set_flag (gcry_mpi_t a, enum gcry_mpi_flag flag)
switch (flag)
{
case GCRYMPI_FLAG_SECURE: mpi_set_secure(a); break;
- case GCRYMPI_FLAG_CONST: a->flags |= (16|32); break;
+ case GCRYMPI_FLAG_CONST:
+ a->flags |= (16|32);
+#if GPGRT_VERSION_NUMBER >= 0x011600 /* 1.22 */
+ gpgrt_annotate_leaked_object(a);
+#endif
+ break;
case GCRYMPI_FLAG_IMMUTABLE: a->flags |= 16; break;
case GCRYMPI_FLAG_USER1: