subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1004348 - /subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
Date Mon, 04 Oct 2010 18:19:53 GMT
Author: hwright
Date: Mon Oct  4 18:19:53 2010
New Revision: 1004348

URL: http://svn.apache.org/viewvc?rev=1004348&view=rev
Log:
My reading of K&R indicates that free'ing a NULL pointer is a no-op, so
let's stop manually checking for that case.

Found by: Philipp Kloke <philipp.kloke@web.de>

* subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
  (callback_destroy_data_keyring, callback_default_keyring,
   password_get_gnome_keyring, password_set_gnome_keyring):
    Don't check for NULL before calling free().

Modified:
    subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c

Modified: subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c?rev=1004348&r1=1004347&r2=1004348&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c (original)
+++ subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c Mon Oct  4 18:19:53
2010
@@ -64,11 +64,8 @@ callback_destroy_data_keyring(void *data
   if (data == NULL)
     return;
 
-  if (key_info->keyring_name)
-    {
-      free((void*)key_info->keyring_name);
-      key_info->keyring_name = NULL;
-    }
+  free((void*)key_info->keyring_name);
+  key_info->keyring_name = NULL;
 
   if (key_info->info)
     {
@@ -132,8 +129,7 @@ callback_default_keyring(GnomeKeyringRes
     }
   else
     {
-      if (key_info->keyring_name != NULL)
-        free((void*)key_info->keyring_name);
+      free((void*)key_info->keyring_name);
       key_info->keyring_name = NULL;
     }
 
@@ -296,8 +292,7 @@ password_get_gnome_keyring(const char **
                    "");
     }
 
-  if (default_keyring)
-    free(default_keyring);
+  free(default_keyring);
 
   return ret;
 }
@@ -347,8 +342,7 @@ password_set_gnome_keyring(apr_hash_t *c
                    "");
     }
 
-  if (default_keyring)
-    free(default_keyring);
+  free(default_keyring);
 
   return result == GNOME_KEYRING_RESULT_OK;
 }



Mime
View raw message