summaryrefslogtreecommitdiff
path: root/lib/routemap.c
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2020-06-09 08:00:00 -0400
committerGitHub <noreply@github.com>2020-06-09 08:00:00 -0400
commit58ef49eb43fd512aad2883f89a218c44b8c4771a (patch)
treebf8fd99751e1d26e1df8ec058c62fad473877555 /lib/routemap.c
parente5f51bc5799233b517980f8f00aaa295cf9b254e (diff)
parentc415a4dcd4f5651ed3e2668f5f88e7d8cbe55fb6 (diff)
Merge pull request #6529 from ton31337/fix/refcnt_check_for_dep_data_route-map
lib: Make sure route_map_dep_data is not NULL before decrementing refcount
Diffstat (limited to 'lib/routemap.c')
-rw-r--r--lib/routemap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/routemap.c b/lib/routemap.c
index 210512212d..3d69a3495a 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -2747,7 +2747,12 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
memset(&tmp_dep_data, 0, sizeof(struct route_map_dep_data));
tmp_dep_data.rname = rname;
dep_data = hash_lookup(dep->dep_rmap_hash, &tmp_dep_data);
- dep_data->refcnt--;
+
+ if (!dep_data)
+ goto out;
+
+ if (dep_data->refcnt)
+ dep_data->refcnt--;
if (!dep_data->refcnt) {
ret_dep_data = hash_release(dep->dep_rmap_hash,