zstd
zstd copied to clipboard
[fix] Add check on failed allocation in legacy/zstd_v06
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.
I'm trying to follow the same coding style used in: https://github.com/facebook/zstd/blob/dev/lib/legacy/zstd_v06.c#L3919
@Cyan4973 anything else you like to see changed in the patch? :-)
Nope, it's good!