]> git.ipfire.org Git - thirdparty/libbsd.git/commit
Fix vis family of functions to not leak
authorGuillem Jover <guillem@hadrons.org>
Wed, 6 Jun 2018 03:41:34 +0000 (05:41 +0200)
committerGuillem Jover <guillem@hadrons.org>
Sun, 17 Jun 2018 21:00:52 +0000 (23:00 +0200)
commit8e2d55047cc9febe38db2b44c4942dd221f182eb
tree31edd96af1b65990dbb38aacb2db9c1a91f8b221
parent13c32916b4baab58d93940d57fea9ff0777f1931
Fix vis family of functions to not leak

The code uses an internal helper function to avoid code repetition. But
to get there, the function takes a pointer to a pointer, so that the few
functions that require returning an allocated buffer can get hold of it
this way.

The problem is that the user might pass a NULL pointer and trigger an
internal allocation even if the functions are not expected to do so.

Add a new internal helper for non-allocations, that will assert that
condition, and make any other function that requires this behavior call
this one instead.

Warned-by: coverity
src/vis.c