Check the return value of krb5_timeofday in krb5int_populate_gic_opt.
authorGreg Hudson <ghudson@mit.edu>
Fri, 10 Apr 2009 19:51:53 +0000 (19:51 +0000)
committerGreg Hudson <ghudson@mit.edu>
Fri, 10 Apr 2009 19:51:53 +0000 (19:51 +0000)
Also initialize krb5int_populate_gic_opt's output variable.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22190 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/gic_pwd.c

index f319c3540c3bf55f8810033d2e1496a77a45e690..3a3f09d14bc23e70cc2667bb2acc0502f93af7f0 100644 (file)
@@ -416,6 +416,7 @@ krb5_error_code krb5int_populate_gic_opt (
   krb5_get_init_creds_opt *opt;
   krb5_error_code retval;
 
+    *opte = NULL;
     retval = krb5_get_init_creds_opt_alloc(context, &opt);
     if (retval)
        return(retval);
@@ -439,12 +440,17 @@ krb5_error_code krb5int_populate_gic_opt (
        krb5_get_init_creds_opt_set_proxiable(opt, 1);
     else krb5_get_init_creds_opt_set_proxiable(opt, 0);
     if (creds && creds->times.endtime) {
-        krb5_timeofday(context, &starttime);
+       retval = krb5_timeofday(context, &starttime);
+       if (retval)
+           goto cleanup;
         if (creds->times.starttime) starttime = creds->times.starttime;
         krb5_get_init_creds_opt_set_tkt_life(opt, creds->times.endtime - starttime);
     }
     return krb5int_gic_opt_to_opte(context, opt, opte, 0,
                                   "krb5int_populate_gic_opt");
+cleanup:
+    krb5_get_init_creds_opt_free(context, opt);
+    return retval;
 }
 
 /*