zstd icon indicating copy to clipboard operation
zstd copied to clipboard

[fix] Add check on failed allocation in legacy/zstd_v06

Open Adenilson opened this issue 1 year ago • 1 comments

As reported by Ben Hawkes in #4026, a failure to allocate a zstd context would lead to a dereference of a NULL pointer due to a missing check on the returned result of ZSTDv06_createDCtx().

This patch fix the issue by adding a check for valid returned pointer.

Adenilson avatar May 17 '24 20:05 Adenilson

I'm trying to follow the same coding style used in: https://github.com/facebook/zstd/blob/dev/lib/legacy/zstd_v06.c#L3919

Adenilson avatar May 17 '24 20:05 Adenilson

@Cyan4973 anything else you like to see changed in the patch? :-)

adenilsoncavalcanti avatar May 21 '24 17:05 adenilsoncavalcanti

Nope, it's good!

Cyan4973 avatar May 21 '24 17:05 Cyan4973