]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Make sure route_map_dep_data is not NULL before decrementing refcount
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Wed, 10 Jun 2020 08:49:21 +0000 (11:49 +0300)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Wed, 10 Jun 2020 08:49:21 +0000 (11:49 +0300)
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
lib/routemap.c

index 14fec0283cafebcb98f9e6559f3b61a5a0172afd..d005c4595db4d619ced6a3909afaa5af506107bf 100644 (file)
@@ -2046,7 +2046,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,