[svn] GnuPG - r5203 - trunk/agent

svn author wk cvs at cvs.gnupg.org
Wed Dec 2 20:00:10 CET 2009


Author: wk
Date: 2009-12-02 20:00:10 +0100 (Wed, 02 Dec 2009)
New Revision: 5203

Modified:
   trunk/agent/ChangeLog
   trunk/agent/trustlist.c
Log:
Fix usage of realloc.


Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog	2009-12-02 18:33:59 UTC (rev 5202)
+++ trunk/agent/ChangeLog	2009-12-02 19:00:10 UTC (rev 5203)
@@ -1,3 +1,10 @@
+2009-12-02  Werner Koch  <wk at g10code.com>
+
+	* 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-11-27  Marcus Brinkmann  <marcus at g10code.de>
 
 	* command.c (start_command_handler): Do not call

Modified: trunk/agent/trustlist.c
===================================================================
--- trunk/agent/trustlist.c	2009-12-02 18:33:59 UTC (rev 5202)
+++ trunk/agent/trustlist.c	2009-12-02 19:00:10 UTC (rev 5203)
@@ -361,13 +361,14 @@
   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;




More information about the Gnupg-commits mailing list