[gnome-software/wip/temp/ubuntu-xenial-rebased: 190/326] gs-ubuntuone: Don't early exit from the libsecret callbacks if one fails



commit c3f058ca2a8611ff67206ecb262e66b904f19d15
Author: Iain Lane <iain orangesquash org uk>
Date:   Wed Apr 6 16:43:40 2016 +0100

    gs-ubuntuone: Don't early exit from the libsecret callbacks if one fails
    
    This is for the no credentials case.
    
    Otherwise we exit from _get_credentials and then there's a
    use-after-free when the other ones return.

 src/plugins/gs-ubuntuone.c |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/src/plugins/gs-ubuntuone.c b/src/plugins/gs-ubuntuone.c
index 9fe63a1..9552256 100644
--- a/src/plugins/gs-ubuntuone.c
+++ b/src/plugins/gs-ubuntuone.c
@@ -59,10 +59,7 @@ lookup_consumer_key (GObject      *source_object,
 
        g_mutex_lock (&context->mutex);
 
-       if (context->consumer_key != NULL)
-               context->waiting--;
-       else
-               context->waiting = 0;
+       context->waiting--;
 
        g_cond_signal (&context->cond);
        g_mutex_unlock (&context->mutex);
@@ -79,10 +76,7 @@ lookup_consumer_secret (GObject      *source_object,
 
        g_mutex_lock (&context->mutex);
 
-       if (context->consumer_secret != NULL)
-               context->waiting--;
-       else
-               context->waiting = 0;
+       context->waiting--;
 
        g_cond_signal (&context->cond);
        g_mutex_unlock (&context->mutex);
@@ -99,10 +93,7 @@ lookup_token_key (GObject      *source_object,
 
        g_mutex_lock (&context->mutex);
 
-       if (context->token_key != NULL)
-               context->waiting--;
-       else
-               context->waiting = 0;
+       context->waiting--;
 
        g_cond_signal (&context->cond);
        g_mutex_unlock (&context->mutex);
@@ -119,10 +110,7 @@ lookup_token_secret (GObject      *source_object,
 
        g_mutex_lock (&context->mutex);
 
-       if (context->token_secret != NULL)
-               context->waiting--;
-       else
-               context->waiting = 0;
+       context->waiting--;
 
        g_cond_signal (&context->cond);
        g_mutex_unlock (&context->mutex);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]