Blob Blame History Raw
From d10be6466e36650ae0598772ece838c9df0f9188 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 22 Oct 2014 11:09:43 +0200
Subject: [LIBREPORT PATCH 105/105] 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
-- 
1.8.3.1