aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2009-12-02 19:02:33 +0000
committerWerner Koch <[email protected]>2009-12-02 19:02:33 +0000
commit56680123a66ca230f96c1bad49059bc02373669e (patch)
tree58a0d9d2f198f75605ee3219b8654ba34cc957f0
parentChange default for --include-certs to -2. (diff)
downloadgnupg-56680123a66ca230f96c1bad49059bc02373669e.tar.gz
gnupg-56680123a66ca230f96c1bad49059bc02373669e.zip
Fix realloc usage. Fixes bug#1163.
-rw-r--r--agent/ChangeLog7
-rw-r--r--agent/trustlist.c3
2 files changed, 9 insertions, 1 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog
index 9d1a9a03f..81bef0214 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,10 @@
+2009-12-02 Werner Koch <[email protected]>
+
+ * trustlist.c (read_trustfiles): Store the pointer returned from
+ shrinking the memory and not the orginal one. Fixes bug#1163.
+ Reported by TAKAHASHI Tamotsu. Also return correct error after
+ memory failure.
+
2009-09-04 Marcus Brinkmann <[email protected]>
* command.c (start_command_handler): Add comment about gap in
diff --git a/agent/trustlist.c b/agent/trustlist.c
index a0b23b51f..be5406b05 100644
--- a/agent/trustlist.c
+++ b/agent/trustlist.c
@@ -361,13 +361,14 @@ read_trustfiles (void)
ti = xtryrealloc (table, (tableidx?tableidx:1) * sizeof *table);
if (!ti)
{
+ err = gpg_error_from_syserror ();
xfree (table);
return err;
}
lock_trusttable ();
xfree (trusttable);
- trusttable = table;
+ trusttable = ti;
trusttablesize = tableidx;
unlock_trusttable ();
return 0;