[svn] assuan - r402 - trunk/src
svn author wk
cvs at cvs.gnupg.org
Mon Dec 20 17:22:06 CET 2010
Author: wk
Date: 2010-12-20 17:22:06 +0100 (Mon, 20 Dec 2010)
New Revision: 402
Modified:
trunk/src/ChangeLog
trunk/src/gpgcedev.c
Log:
Check malloc and CreateEvent return codes.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2010-12-14 11:21:25 UTC (rev 401)
+++ trunk/src/ChangeLog 2010-12-20 16:22:06 UTC (rev 402)
@@ -1,3 +1,8 @@
+2010-12-20 Werner Koch <wk at g10code.com>
+
+ * gpgcedev.c (pipeimpl_new): Check malloc and CreateEvent return
+ codes.
+
2010-12-14 Werner Koch <wk at g10code.com>
* gpgcemgr.c (wchar_to_utf8, utf8_to_wchar, set_show_registry): New.
Modified: trunk/src/gpgcedev.c
===================================================================
--- trunk/src/gpgcedev.c 2010-12-14 11:21:25 UTC (rev 401)
+++ trunk/src/gpgcedev.c 2010-12-20 16:22:06 UTC (rev 402)
@@ -251,11 +251,32 @@
pimpl->refcnt = 1;
pimpl->buffer_size = 512;
pimpl->buffer = malloc (pimpl->buffer_size);
+ if (!pimpl->buffer)
+ {
+ DeleteCriticalSection (&pimpl->critsect);
+ free (pimpl);
+ return NULL;
+ }
pimpl->buffer_len = 0;
pimpl->buffer_pos = 0;
pimpl->flags = 0;
pimpl->space_available = CreateEvent (NULL, FALSE, FALSE, NULL);
+ if (!pimpl->space_available)
+ {
+ free (pimpl->buffer);
+ DeleteCriticalSection (&pimpl->critsect);
+ free (pimpl);
+ return NULL;
+ }
pimpl->data_available = CreateEvent (NULL, FALSE, FALSE, NULL);
+ if (!pimpl->data_available)
+ {
+ CloseHandle (pimpl->space_available);
+ free (pimpl->buffer);
+ DeleteCriticalSection (&pimpl->critsect);
+ free (pimpl);
+ return NULL;
+ }
pimpl->monitor_proc = INVALID_HANDLE_VALUE;
pimpl->monitor_access = 0;
pimpl->monitor_rvid = 0;
More information about the Gnupg-commits
mailing list