]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Free unconditionally in plugins.c
authorGreg Hudson <ghudson@mit.edu>
Fri, 29 Mar 2013 06:53:27 +0000 (02:53 -0400)
committerGreg Hudson <ghudson@mit.edu>
Fri, 29 Mar 2013 15:38:39 +0000 (11:38 -0400)
Get rid of unnecessary null checks before freeing values in
libkrb5support's plugin code.

src/util/support/plugins.c

index 608d03c2f1b8bb703c08733f97ac397bc0e2f534..a04dfc38e9e53bab47430fc1a859f548e6038608 100644 (file)
@@ -155,8 +155,8 @@ int closedir(DIR *dp)
 {
     if (!dp) return 0;
     _findclose(dp->handle);
-    if (dp->dir) free(dp->dir);
-    if (dp) free(dp);
+    free(dp->dir);
+    free(dp);
 
     return 0;
 }
@@ -317,7 +317,7 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct
         htmp = NULL;  /* h takes ownership */
     }
 
-    if (htmp != NULL) { free (htmp); }
+    free(htmp);
 
     return err;
 }
@@ -551,7 +551,7 @@ krb5int_get_plugin_filenames (const char * const *filebases, char ***filenames)
         tempnames = NULL;
     }
 
-    if (tempnames) { krb5int_free_plugin_filenames (tempnames); }
+    krb5int_free_plugin_filenames(tempnames);
 
     return err;
 }
@@ -602,7 +602,7 @@ krb5int_open_plugin_dirs (const char * const *dirnames,
                     if (!err) { handle = NULL; }  /* h takes ownership */
                 }
 
-                if (filepath != NULL) { free (filepath); }
+                free(filepath);
                 if (handle   != NULL) { krb5int_close_plugin (handle); }
             }
         } else {
@@ -637,7 +637,7 @@ krb5int_open_plugin_dirs (const char * const *dirnames,
                     }
                 }
 
-                if (filepath  != NULL) { free (filepath); }
+                free(filepath);
                 if (handle    != NULL) { krb5int_close_plugin (handle); }
             }
 
@@ -727,7 +727,7 @@ krb5int_get_plugin_dir_data (struct plugin_dir_handle *dirhandle,
         p = NULL; /* ptrs takes ownership */
     }
 
-    if (p != NULL) { free (p); }
+    free(p);
 
     return err;
 }
@@ -786,7 +786,7 @@ krb5int_get_plugin_dir_func (struct plugin_dir_handle *dirhandle,
         p = NULL; /* ptrs takes ownership */
     }
 
-    if (p != NULL) { free (p); }
+    free(p);
 
     return err;
 }