Closed voldymyr closed 2 years ago
Whether a function returns a reference (ownership) or not, is up to the function. In libnl, that is unfortunately not done consistently, and usually it's also unnecessary to return a reference. There is really no need that a function rtnl_act_next()
should return a reference (except maybe an argument for consistency with other API).
In any case, changing whether a function returns ownership or not, is an API change (because it changes whether the caller is supposed to return the reference).
Why do you think this function should return a reference? This function exists now for 5 years, we cannot break API this way.
Also, inside libnl source tree, there is only one caller of this function (mall_clone()
). And this caller does not expect that it gets ownership of the reference, so this change will introduce a bug there.
As said, I think this patch is not something we can change, because it breaks existing API. Also, it causes a leak in mall_clone()
.
I will close this MR. If you have anything to add, please comment or reopen.
Thank you!!
Make sure the 'next' action is non-null and 'get' it with rtnl_act_get().
Having completed the work with action the user is responsible to call rtnl_act_put()
Signed-off-by: Volodymyr Bendiuga volodymyr.bendiuga@westermo.com