mirror of
https://github.com/openharmony/third_party_libnl.git
synced 2026-07-19 12:09:14 -04:00
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:
committed by
Thomas Haller
parent
27c404ab71
commit
4c95465987
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user