Merge pull request #6035 from qlyoung/fix-nexthop-label-nullity-before-free

lib: remove null check before free nh_labels
This commit is contained in:
Santosh P K 2020-03-24 21:29:06 +05:30 committed by GitHub
commit aa50bf0618
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -415,10 +415,8 @@ void nexthop_add_labels(struct nexthop *nexthop, enum lsp_types_t type,
/* Free label information of nexthop, if present. */ /* Free label information of nexthop, if present. */
void nexthop_del_labels(struct nexthop *nexthop) void nexthop_del_labels(struct nexthop *nexthop)
{ {
if (nexthop->nh_label) { XFREE(MTYPE_NH_LABEL, nexthop->nh_label);
XFREE(MTYPE_NH_LABEL, nexthop->nh_label); nexthop->nh_label_type = ZEBRA_LSP_NONE;
nexthop->nh_label_type = ZEBRA_LSP_NONE;
}
} }
const char *nexthop2str(const struct nexthop *nexthop, char *str, int size) const char *nexthop2str(const struct nexthop *nexthop, char *str, int size)