MFC rev. 1.25

Add a missing return so that we drop out in case of an error and
  do not continue with a NULL pointer. [1]

  While here change the return of the error handling code path above.
  I cannot see why we should always return 0 there. Neither does KAME
  nor do we in here for the similar check in all the other functions.

  Found with:     Coverity Prevent(tm) [1]
  CID:            2521
This commit is contained in:
bz 2008-03-08 18:34:17 +00:00
parent c2be452caa
commit 633096586a

View File

@ -2116,8 +2116,7 @@ key_spddelete2(so, m, mhp)
if (mhp->ext[SADB_X_EXT_POLICY] == NULL ||
mhp->extlen[SADB_X_EXT_POLICY] < sizeof(struct sadb_x_policy)) {
ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__));
key_senderror(so, m, EINVAL);
return 0;
return key_senderror(so, m, EINVAL);
}
id = ((struct sadb_x_policy *)mhp->ext[SADB_X_EXT_POLICY])->sadb_x_policy_id;
@ -2125,7 +2124,7 @@ key_spddelete2(so, m, mhp)
/* Is there SP in SPD ? */
if ((sp = key_getspbyid(id)) == NULL) {
ipseclog((LOG_DEBUG, "%s: no SP found id:%u.\n", __func__, id));
key_senderror(so, m, EINVAL);
return key_senderror(so, m, EINVAL);
}
sp->state = IPSEC_SPSTATE_DEAD;