Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor Numa safety patches #712

Merged
merged 2 commits into from
Aug 26, 2023
Merged

Conversation

GerHobbelt
Copy link
Contributor

See also the commit messages... I hit upon these thanks to my own misuse of one these APIs (unintentionally feeding it a NUMA array of zero length) and I got some random weird results with MSVC2022, then I investigated and found numaGetCount() == 0 was not reckoned with. Followed up that one with an overall code review and fixed all the spots where the code for the count == 0 scenario was either non-trivial or would potentially produce random/garbage results.

(For example, a zero-length calloc on my system is a hard fail because it's way too often indicative of faulty coding somewhere, so I won't wait for LEPT_CALLOC to b0rk with a NULL return. This is more... pedantic than one may expect on Linuxes in general.)

…histogram is empty (count = 0)

(Discovered through code review.)
…-initialized to cope with the fringe case where the NUMA histogram is empty (count = 0)

(Discovered through code review & accidental misuse in vitro (when I fed numaHistogramGetValFromRank() an empty histogram by accident).)
Copy link
Owner

@DanBloomberg DanBloomberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

colorquant1.c
this return leaks the index tables. Easiest is to swap the two sections.
Should probably initialize octarray and colorarray to NULL when declared above. If that is done, then you can goto cleanup_arrays if numaGetCount() fails without swapping sections.

@DanBloomberg DanBloomberg merged commit d819f01 into DanBloomberg:master Aug 26, 2023
9 of 10 checks passed
@DanBloomberg
Copy link
Owner

merged; thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants