Ensure profile_iterator always sets output params
authorGreg Hudson <ghudson@mit.edu>
Tue, 26 Jul 2011 11:37:24 +0000 (11:37 +0000)
committerGreg Hudson <ghudson@mit.edu>
Tue, 26 Jul 2011 11:37:24 +0000 (11:37 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25057 dc483132-0cff-0310-8789-dd5450dbe970

src/util/profile/prof_get.c

index b2ea40ce1a2de6fc87c0a30f50a0dfdd820bbf4a..3eba7872229c9a945b380cc816aa6f3e18f54e41 100644 (file)
@@ -564,10 +564,6 @@ set_results(const char *name, const char *value, char **ret_name,
 oom:
     free(name_copy);
     free(value_copy);
-    if (ret_name)
-        *ret_name = NULL;
-    if (ret_value)
-        *ret_value = NULL;
     return ENOMEM;
 }
 
@@ -579,6 +575,10 @@ profile_iterator(void **iter_p, char **ret_name, char **ret_value)
     struct profile_iterator *iter = *iter_p;
     profile_t profile;
 
+    if (ret_name)
+        *ret_name = NULL;
+    if (ret_value)
+        *ret_value = NULL;
     if (iter->magic != PROF_MAGIC_ITERATOR)
         return PROF_MAGIC_ITERATOR;
     profile = iter->profile;