git: 7539b04ed7a4 - main - ipsec_newpolicies(): do not call key_freesp() with NULL value
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 12 Jul 2024 11:24:51 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=7539b04ed7a462afde4d3aaae7f6ba234a868158
commit 7539b04ed7a462afde4d3aaae7f6ba234a868158
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-08-22 19:19:06 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-07-12 03:29:30 +0000
ipsec_newpolicies(): do not call key_freesp() with NULL value
Sponsored by: NVIDIA networking
MFC after: 1 week
---
sys/net/if_ipsec.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sys/net/if_ipsec.c b/sys/net/if_ipsec.c
index 5f43225bfaed..b503d0696691 100644
--- a/sys/net/if_ipsec.c
+++ b/sys/net/if_ipsec.c
@@ -901,8 +901,10 @@ ipsec_newpolicies(struct ipsec_softc *sc, struct secpolicy *sp[IPSEC_SPCOUNT],
}
return (0);
fail:
- for (i = 0; i < IPSEC_SPCOUNT; i++)
- key_freesp(&sp[i]);
+ for (i = 0; i < IPSEC_SPCOUNT; i++) {
+ if (sp[i] != NULL)
+ key_freesp(&sp[i]);
+ }
return (ENOMEM);
}