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

[multiple-ddicts] Fix NULL checks #2817

Merged
merged 1 commit into from
Oct 8, 2021

Conversation

terrelln
Copy link
Contributor

@terrelln terrelln commented Oct 8, 2021

The bug was reported by Dan Carpenter and found by Smatch static
checker.

https://lore.kernel.org/all/20211008063704.GA5370@kili/

ret->ddictPtrTable = (const ZSTD_DDict**)ZSTD_customCalloc(DDICT_HASHSET_TABLE_BASE_SIZE * sizeof(ZSTD_DDict*), customMem);
if (!ret->ddictPtrTable)
return NULL;
Copy link
Contributor

Choose a reason for hiding this comment

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

I presume there should be some kind of ZSTD_customFree(ret, customMem) here.

The bug was reported by Dan Carpenter and found by Smatch static
checker.

https://lore.kernel.org/all/20211008063704.GA5370@kili/
@terrelln
Copy link
Contributor Author

terrelln commented Oct 8, 2021

This code isn't really used anywhere yet, but it shows again the need to have some malloc fault injection test.

Copy link
Contributor

@senhuang42 senhuang42 left a comment

Choose a reason for hiding this comment

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

Gah. I think there's a law that says that I will fail to check every 10th malloc() for sucess properly.

@terrelln terrelln merged commit 9c9a5f3 into facebook:dev Oct 8, 2021
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.

3 participants