Hi,
Static analysis tool we use has found quite a lot of potential issues in hwloc.
Most of them are type of "NULL ptr dereference" i.e. when pointer is not
checked for null after allocation, but there are some more interesting cases as
well.
My team distributes hwloc as a part of software packag
Hello
We're running coverity every night and I try to address most of what it
reports (except the netloc/ directory git master which still needs a lot
of work). What tool do you use?
It's true we don't check malloc() return values in many cases (hopefully
only the small allocations), mostly becau
Hi,
I use klocwork, which doesn't mean it is better it just reports different
subset of potential errors.
Ignoring malloc errors is your design decision, I don't mind it.
>From debugging perspective it makes it easier to track it down since you have
>null ptr dereference somewhere near malloc .
Hi Brice,
I use following custom routines to check for malloc related errors.
Just my 2 cents.
Jirka
void *util_Malloc (size_t size)
{
void *p;
errno = 0;
p = malloc (size);
if (p == NULL) {
fprintf (stdout, "\nmalloc failed: %s\n\n", strerror (errno));
exit (EXIT_FAILUR
Hi Jirka,
It should be safe to do free(NULL) so last function can be shortened to only 2
lines.
IIRC *alloc fuctions should not set errno on error to anything else than ENOMEM
so you could get rid of errno references in your wrappers.
Removing else before return p; statement should take care of t