From 656444ed2606cba8be76b9de8792dc36f72d946c Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 15 Oct 2018 21:07:01 -0400
Subject: [PATCH 050/142] event-loop: fix leak in error path

ply_event_loop_new fails to clean itself up if it's unable to
create a pipe for dispatching signals.

This commit fixes that.
---
 src/libply/ply-event-loop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/libply/ply-event-loop.c b/src/libply/ply-event-loop.c
index 9736dae..0e8ad7c 100644
--- a/src/libply/ply-event-loop.c
+++ b/src/libply/ply-event-loop.c
@@ -496,8 +496,10 @@ ply_event_loop_new (void)
 
         loop->signal_dispatcher = ply_signal_dispatcher_new ();
 
-        if (loop->signal_dispatcher == NULL)
+        if (loop->signal_dispatcher == NULL) {
+                ply_event_loop_free (loop);
                 return NULL;
+        }
 
         ply_event_loop_watch_fd (loop,
                                  ply_signal_dispatcher_receiver_fd,
-- 
2.7.4

