lib: fix a64448ba, invalid NULL->num_labels

We should assume match OK only when neither nhl1
and neither nhl2 are NULL.
If both are NULL, it means match NOK.

Clang Warning:
  Access to field 'num_labels' results in a dereference of a null
  pointer (loaded from variable 'nhl1')

Signed-off-by: Vincent Jardin <vincent.jardin@6wind.com>
This commit is contained in:
Vincent JARDIN 2017-10-09 12:32:05 +02:00
parent 67533c11d2
commit 3f58e1b3e7

View File

@ -128,7 +128,7 @@ int nexthop_labels_match(struct nexthop *nh1, struct nexthop *nh2)
nhl1 = nh1->nh_label;
nhl2 = nh2->nh_label;
if ((nhl1 && !nhl2) || (!nhl1 && nhl2))
if (!nhl1 || !nhl2)
return 0;
if (nhl1->num_labels != nhl2->num_labels)