new libgcrypt

Werner Koch wk@gnupg.org
Thu, 07 Aug 2003 08:28:02 +0200


On Wed, 6 Aug 2003 22:10:29 +0300, Nikos Mavroyanopoulos said:

> Program received signal SIGSEGV, Segmentation fault.
> _gcry_module_release (module=0x0) at module.c:156

Fixed in CVS:

diff -u -r1.6 -r1.7
--- src/module.c        14 Jul 2003 22:33:41 -0000      1.6
+++ src/module.c        7 Aug 2003 06:20:53 -0000       1.7
@@ -149,11 +149,12 @@
 }
 
 /* Release a module.  In case the use-counter reaches zero, destroy
-   the module.  */
+   the module.  Passing MODULE as NULL is a dummy operation (similar
+   to free()). */
 void
 _gcry_module_release (gcry_module_t module)
 {
-  if (! --module->counter)
+  if (module && ! --module->counter)
     _gcry_module_drop (module);
 }
 

It happens in the error handling part of some code.  In general it is
a good idea to allow release functions to take a NULL argument to make
cleanup after errors easier.

Thanks,

  Werner


-- 
Werner Koch                                      <wk@gnupg.org>
The GnuPG Experts                                http://g10code.com
Free Software Foundation Europe	                 http://fsfeurope.org