From 4c95465987db1ecceea000e9aebd0f83e4bffe42 Mon Sep 17 00:00:00 2001 From: Amit Khatri Date: Tue, 22 Aug 2017 23:34:50 -0700 Subject: Potential memory leak becaue of wrong variable check. in rtnl_link_vf_vlan_alloc() function allocating memory to vlans while checking NULL or not vf_vlans. it can cause memory leak. Signed-off-by: Amit Khatri Signed-off-by: Rohit Pratap Singh Fixes: 5d6e43ebef12deadf31fccfa46c0b34892675d36 http://lists.infradead.org/pipermail/libnl/2017-August/002373.html --- lib/route/link/sriov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/route/link/sriov.c b/lib/route/link/sriov.c index b4bc9a7e..5c20ecff 100644 --- a/lib/route/link/sriov.c +++ b/lib/route/link/sriov.c @@ -1315,7 +1315,7 @@ int rtnl_link_vf_vlan_alloc(nl_vf_vlans_t **vf_vlans, int vlan_count) { return -NLE_INVAL; vlans = calloc(1, sizeof(*vlans)); - if (!vf_vlans) + if (!vlans) return -NLE_NOMEM; vlan_info = calloc(vlan_count+1, sizeof(*vlan_info)); -- cgit v1.2.3