Blob Blame History Raw
From 256a8e48db14512357f8e1412018a88b3003bbce Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 22 Oct 2014 11:09:43 +0200
Subject: [PATCH] rhtsupport: do not leak the hints results

The leak was introduced in commit
5ff7f36c1a06f5317241b43999f4f03a21594c79

Related to rhbz#1139987

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
 src/plugins/reporter-rhtsupport.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index 4b74c5c..add0d6b 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -275,6 +275,7 @@ void attach_to_ureport(struct ureport_server_config *conf,
 static
 bool check_for_hints(const char *url, char **login, char **password, bool ssl_verify, const char *tempfile)
 {
+    bool retval = false;
     rhts_result_t *result = NULL;
 
     INVALID_CREDENTIALS_LOOP((*login), (*password),
@@ -317,14 +318,18 @@ bool check_for_hints(const char *url, char **login, char **password, bool ssl_ve
             hint = append_to_malloced_string(hint,
                     _("Do you still want to create a RHTSupport ticket?")
                     );
-            int create_ticket = ask_yes_no(hint);
+
+            /*
+             * 'Yes' to the create ticket question means no hints were found.
+             */
+            retval = !ask_yes_no(hint);
+
             free(hint);
-            if (!create_ticket)
-                return true;
         }
     }
+
     free_rhts_result(result);
-    return false;
+    return retval;
 }
 
 static
-- 
2.1.0