Fix a case in the krb5_rd_rep error handler (introduced in the last
authorGreg Hudson <ghudson@mit.edu>
Tue, 5 May 2009 16:00:40 +0000 (16:00 +0000)
committerGreg Hudson <ghudson@mit.edu>
Tue, 5 May 2009 16:00:40 +0000 (16:00 +0000)
commit) where scratch.data could be indirected through even if it
wasn't allocated successfully.

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

src/lib/krb5/krb/rd_rep.c

index fe6c76375ac3b39589ecc93771d60269b4a61769..1e3c145263abcb10c7ae0eb11cc090c9f345c490 100644 (file)
@@ -145,10 +145,11 @@ krb5_rd_rep(krb5_context context, krb5_auth_context auth_context,
     enc = NULL;
 
 clean_scratch:
-    memset(scratch.data, 0, scratch.length); 
+    if (scratch.data)
+       memset(scratch.data, 0, scratch.length); 
+    free(scratch.data);
     krb5_free_ap_rep(context, reply);
     krb5_free_ap_rep_enc_part(context, enc);
-    free(scratch.data);
     return retval;
 }