On 7/30/20 1:21 AM, Andrii Nakryiko wrote:
Most of libbpf "constructors" on failure return ERR_PTR(err) result encoded as a pointer. It's a common mistake to eventually pass such malformed pointers into xxx__destroy()/xxx__free() "destructors". So instead of fixing up clean up code in selftests and user programs, handle such error pointers in destructors themselves. This works beautifully for NULL pointers passed to destructors, so might as well just work for error pointers. Suggested-by: Song Liu <songliubraving@xxxxxx> Signed-off-by: Andrii Nakryiko <andriin@xxxxxx>
Applied, thanks!