diff options
author | Amit Khatri <amit.khatri@samsung.com> | 2017-08-22 23:34:50 -0700 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-09-01 09:44:17 +0200 |
commit | 4c95465987db1ecceea000e9aebd0f83e4bffe42 (patch) | |
tree | d88af01733b7d417dafbd45e3d0e9a5a15ee325f /lib | |
parent | 27c404ab71f6ad6e3cd46f9a1f0dc3cc00653da8 (diff) | |
download | libnl-4c95465987db1ecceea000e9aebd0f83e4bffe42.tar.gz |
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 <amit.khatri@samsung.com>
Signed-off-by: Rohit Pratap Singh <rohit.s@samsung.com>
Fixes: 5d6e43ebef12deadf31fccfa46c0b34892675d36
http://lists.infradead.org/pipermail/libnl/2017-August/002373.html
Diffstat (limited to 'lib')
-rw-r--r-- | lib/route/link/sriov.c | 2 |
1 files changed, 1 insertions, 1 deletions
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)); |