From: John Kohl Date: Wed, 16 Jan 1991 11:06:42 +0000 (+0000) Subject: finish cleanup from conversion to take donot_replay X-Git-Tag: krb5-1.0-alpha4~340 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fdd1e761886a9b95e4c09464b9cc3f54d0e2342b;p=krb5.git finish cleanup from conversion to take donot_replay (don't free things from the argument!) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1632 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/rcache/rc_dfl.c b/src/lib/krb5/rcache/rc_dfl.c index 15382a2f2..a8a9e4f0e 100644 --- a/src/lib/krb5/rcache/rc_dfl.c +++ b/src/lib/krb5/rcache/rc_dfl.c @@ -129,6 +129,19 @@ struct authlist } ; +/* XXX should we use strdup? */ +static char * +strsave(s) +register const char *s; +{ + register char *ret; + + if (ret = malloc(strlen(s)+1)) { + (void) strcpy(ret, s); + return ret; + } + return 0; +} /* of course, list is backwards from file */ /* hash could be forwards since we have to search on match, but naaaah */ @@ -159,7 +172,16 @@ krb5_donot_replay *rep; ta->na = t->a; t->a = ta; ta->nh = t->h[rephash]; t->h[rephash] = ta; ta->rep = *rep; - + if (!(ta->rep.client = strsave(rep->client))) { + FREE(ta); + return CMP_MALLOC; + } + if (!(ta->rep.server = strsave(rep->server))) { + FREE(ta->rep.client); + FREE(ta); + return CMP_MALLOC; + } + return CMP_HOHUM; } @@ -333,9 +355,9 @@ krb5_donot_replay *rep; switch(store(id,rep)) { - case CMP_MALLOC: FREE(rep->client); FREE(rep->server); FREE(rep); + case CMP_MALLOC: return KRB5_RC_MALLOC; break; - case CMP_REPLAY: FREE(rep->client); FREE(rep->server); FREE(rep); + case CMP_REPLAY: return KRB5KRB_AP_ERR_REPEAT; break; case 0: break; default: /* wtf? */ ;