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: 5d6e43ebef

http://lists.infradead.org/pipermail/libnl/2017-August/002373.html
This commit is contained in:
Amit Khatri
2017-08-22 23:34:50 -07:00
committed by Thomas Haller
parent 27c404ab71
commit 4c95465987
+1 -1
View File
@@ -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));