From 8c76f4d7f903fbcd072d61d9f5fa030a31a6fdf4 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sat, 8 Sep 2012 20:08:54 -0400 Subject: [PATCH] Check for ENOMEM when appending to the connection list. --- src/pwmd.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/pwmd.c b/src/pwmd.c index e1026865..c928a76b 100644 --- a/src/pwmd.c +++ b/src/pwmd.c @@ -1042,13 +1042,19 @@ static gpg_error_t init_client_thread(gint fd, const gchar *addr) } if (!rc) { - cn_thread_list = g_slist_append(cn_thread_list, new); - if (addr) - log_write(_("new connection: tid=%p, fd=%i, addr=%s"), - (pthread_t *)new->tid, fd, addr); + GSList *list = g_slist_append(cn_thread_list, new); + + if (list) { + cn_thread_list = list; + if (addr) + log_write(_("new connection: tid=%p, fd=%i, addr=%s"), + (pthread_t *)new->tid, fd, addr); + else + log_write(_("new connection: tid=%p, fd=%i"), + (pthread_t *)new->tid, fd); + } else - log_write(_("new connection: tid=%p, fd=%i"), - (pthread_t *)new->tid, fd); + rc = GPG_ERR_ENOMEM; } pthread_cleanup_pop(1); -- 2.11.4.GIT