svn rev #25047: trunk/src/util/profile/ 
    ghudson@MIT.EDU 
    ghudson at MIT.EDU
       
    Mon Jul 25 11:54:39 EDT 2011
    
    
  
http://src.mit.edu/fisheye/changelog/krb5/?cs=25047
Commit By: ghudson
Log Message:
Never return profile on error opening file.
If profile_open_file() discovers a shared tree for the file, but
encounters an error when updating it, dereference the data and return
a null profile rather than returning an error and a newly broken file
object.  Otherwise we'd leak the returned file object in
profile_init().
Changed Files:
U   trunk/src/util/profile/prof_file.c
Modified: trunk/src/util/profile/prof_file.c
===================================================================
--- trunk/src/util/profile/prof_file.c	2011-07-25 15:54:36 UTC (rev 25046)
+++ trunk/src/util/profile/prof_file.c	2011-07-25 15:54:39 UTC (rev 25047)
@@ -258,10 +258,15 @@
         (void) k5_mutex_unlock(&g_shared_trees_mutex);
         retval = profile_update_file_data(data, NULL);
         free(expanded_filename);
+        if (retval) {
+            profile_dereference_data(data);
+            free(prf);
+            return retval;
+        }
         prf->data = data;
         *ret_prof = prf;
         scan_shared_trees_unlocked();
-        return retval;
+        return 0;
     }
     (void) k5_mutex_unlock(&g_shared_trees_mutex);
     data = profile_make_prf_data(expanded_filename);
    
    
More information about the cvs-krb5
mailing list