[librest/wip/hadess/compilation-fixes: 1/2] auth: Fix compile-time warnings




commit d93280e01a923facccebf6042513ff66492705ca
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Feb 2 11:27:31 2022 +0100

    auth: Fix compile-time warnings
    
    ../rest/rest-oauth2-proxy.c: In function ‘rest_oauth2_proxy_build_authorization_url’:
    /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: warning: ‘params_string’ may be used uninitialized 
[-Wmaybe-uninitialized]
       28 |   g_free (*pp);
          |   ^~~~~~~~~~~~
    ../rest/rest-oauth2-proxy.c:355:21: note: ‘params_string’ was declared here
      355 |   g_autofree gchar *params_string;
          |                     ^~~~~~~~~~~~~
    
    ../rest/rest-oauth2-proxy.c: In function ‘rest_oauth2_proxy_new_call’:
    /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: warning: ‘auth’ may be used uninitialized in this 
function [-Wmaybe-uninitialized]
       28 |   g_free (*pp);
          |   ^~~~~~~~~~~~
    ../rest/rest-oauth2-proxy.c:114:21: note: ‘auth’ was declared here
      114 |   g_autofree gchar *auth;
          |                     ^~~~

 rest/rest-oauth2-proxy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/rest/rest-oauth2-proxy.c b/rest/rest-oauth2-proxy.c
index f15b589..fb66f91 100644
--- a/rest/rest-oauth2-proxy.c
+++ b/rest/rest-oauth2-proxy.c
@@ -111,7 +111,7 @@ rest_oauth2_proxy_new_call (RestProxy *proxy)
 {
   RestOAuth2Proxy *self = (RestOAuth2Proxy *)proxy;
   RestProxyCall *call;
-  g_autofree gchar *auth;
+  g_autofree gchar *auth = NULL;
 
   g_return_val_if_fail (REST_IS_OAUTH2_PROXY (self), NULL);
 
@@ -352,7 +352,7 @@ rest_oauth2_proxy_build_authorization_url (RestOAuth2Proxy  *self,
   g_autoptr(GHashTable) params = NULL;
   g_autoptr(GUri) auth = NULL;
   g_autoptr(GUri) authorization_url = NULL;
-  g_autofree gchar *params_string;
+  g_autofree gchar *params_string = NULL;
 
   g_return_val_if_fail (REST_IS_OAUTH2_PROXY (self), NULL);
 


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