summaryrefslogtreecommitdiffstats
path: root/lib/route
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-04-22 16:19:36 (GMT)
committerThomas Haller <thaller@redhat.com>2022-04-22 17:04:19 (GMT)
commit6615dc0d38856855d37d34dadf70cfa610bd20f2 (patch)
tree07565a9990dd09da7750bac9fb88be7dfc6b61b6 /lib/route
parentff5ef61df6219743792867a3e782d8a7ceb7a290 (diff)
downloadlibnl-6615dc0d38856855d37d34dadf70cfa610bd20f2.zip
libnl-6615dc0d38856855d37d34dadf70cfa610bd20f2.tar.gz
libnl-6615dc0d38856855d37d34dadf70cfa610bd20f2.tar.bz2
route/link: workaround coverity warning about leak in rtnl_link_set_type()
I think the following warning is bogus. Still, warnings are annoying, so let's try to workaround. Error: CLANG_WARNING: [#def47] libnl-3.6.0/lib/route/link.c:2566:11: warning[unix.Malloc]: Potential leak of memory pointed to by 'kind' # 2564| if ( io->io_alloc # 2565| && (err = io->io_alloc(link)) < 0) # 2566|-> return err; # 2567| # 2568| link->l_info_ops = io;
Diffstat (limited to 'lib/route')
-rw-r--r--lib/route/link.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/route/link.c b/lib/route/link.c
index 79c5c5c..65f3dbb 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -2560,9 +2560,10 @@ int rtnl_link_set_type(struct rtnl_link *link, const char *type)
io = rtnl_link_info_ops_lookup(type);
if (io) {
- if ( io->io_alloc
- && (err = io->io_alloc(link)) < 0)
+ if (io->io_alloc && (err = io->io_alloc(link)) < 0) {
+ _nl_clear_free(&kind);
return err;
+ }
link->l_info_ops = io;
}