check some more initialization result
ensure it's not NULL.
This commit is contained in:
parent
111df0fa45
commit
5ef4f3ce91
@ -1126,6 +1126,7 @@ _failure:
|
||||
int LZ4_compress_fast_extState(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration)
|
||||
{
|
||||
LZ4_stream_t_internal* const ctx = & LZ4_initStream(state, sizeof(LZ4_stream_t)) -> internal_donotuse;
|
||||
assert(ctx != NULL);
|
||||
if (acceleration < 1) acceleration = ACCELERATION_DEFAULT;
|
||||
if (maxOutputSize >= LZ4_compressBound(inputSize)) {
|
||||
if (inputSize < LZ4_64Klimit) {
|
||||
@ -1236,7 +1237,8 @@ int LZ4_compress_fast_force(const char* src, char* dst, int srcSize, int dstCapa
|
||||
* _continue() call without resetting it. */
|
||||
static int LZ4_compress_destSize_extState (LZ4_stream_t* state, const char* src, char* dst, int* srcSizePtr, int targetDstSize)
|
||||
{
|
||||
LZ4_initStream(state, sizeof (*state));
|
||||
void* const s = LZ4_initStream(state, sizeof (*state));
|
||||
assert(s != NULL); (void)s;
|
||||
|
||||
if (targetDstSize >= LZ4_compressBound(*srcSizePtr)) { /* compression success is guaranteed */
|
||||
return LZ4_compress_fast_extState(state, src, dst, *srcSizePtr, targetDstSize, 1);
|
||||
@ -1307,6 +1309,8 @@ LZ4_stream_t* LZ4_initStream (void* buffer, size_t size)
|
||||
return (LZ4_stream_t*)buffer;
|
||||
}
|
||||
|
||||
/* resetStream is now deprecated,
|
||||
* prefer initStream() which is more general */
|
||||
void LZ4_resetStream (LZ4_stream_t* LZ4_stream)
|
||||
{
|
||||
DEBUGLOG(5, "LZ4_resetStream (ctx:%p)", LZ4_stream);
|
||||
|
Loading…
Reference in New Issue
Block a user