[Pkg-gnupg-commit] [libassuan] 344/437: Check malloc and CreateEvent return codes.

Eric Dorland eric at moszumanska.debian.org
Fri May 22 05:34:01 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository libassuan.

commit 20b033a630a35d1980ecef3f06f68b7edae1ac1f
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Dec 20 16:22:06 2010 +0000

    Check malloc and CreateEvent return codes.
---
 src/ChangeLog  |  5 +++++
 src/gpgcedev.c | 21 +++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index 6098e33..2199e24 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/gpgcedev.c b/src/gpgcedev.c
index 69dcd6f..a097c88 100644
--- a/src/gpgcedev.c
+++ b/src/gpgcedev.c
@@ -251,11 +251,32 @@ pipeimpl_new (void)
   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;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libassuan.git



More information about the Pkg-gnupg-commit mailing list