summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/libtiff/libtiff/tif_zstd.c
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2023-06-09 17:08:51 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-06-09 17:08:51 +0300
commit6a1af670d52492ab0955933b830026b2a18ed6d6 (patch)
tree14e423ab81da7312ac0f800aaa6afce7e23abc20 /src/3rdparty/libtiff/libtiff/tif_zstd.c
parente57b0df609d744c3ddb2d3f23926a7922e661cb6 (diff)
parent8fb9a4fdcb05984bb6e9e532e4462aa7bfbeb62e (diff)
Merge remote-tracking branch 'origin/tqtc/lts-5.15.11' into tqtc/lts-5.15-opensourcev5.15.11-lts-lgpl
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_zstd.c')
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_zstd.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/3rdparty/libtiff/libtiff/tif_zstd.c b/src/3rdparty/libtiff/libtiff/tif_zstd.c
index 14ac081..960aa90 100644
--- a/src/3rdparty/libtiff/libtiff/tif_zstd.c
+++ b/src/3rdparty/libtiff/libtiff/tif_zstd.c
@@ -101,18 +101,16 @@ ZSTDPreDecode(TIFF* tif, uint16_t s)
if( (sp->state & LSTATE_INIT_DECODE) == 0 )
tif->tif_setupdecode(tif);
- if( sp->dstream )
+ if( sp->dstream == NULL )
{
- ZSTD_freeDStream(sp->dstream);
- sp->dstream = NULL;
+ sp->dstream = ZSTD_createDStream();
+ if( sp->dstream == NULL ) {
+ TIFFErrorExt(tif->tif_clientdata, module,
+ "Cannot allocate decompression stream");
+ return 0;
+ }
}
- sp->dstream = ZSTD_createDStream();
- if( sp->dstream == NULL ) {
- TIFFErrorExt(tif->tif_clientdata, module,
- "Cannot allocate decompression stream");
- return 0;
- }
zstd_ret = ZSTD_initDStream(sp->dstream);
if( ZSTD_isError(zstd_ret) ) {
TIFFErrorExt(tif->tif_clientdata, module,
@@ -203,15 +201,13 @@ ZSTDPreEncode(TIFF* tif, uint16_t s)
if( sp->state != LSTATE_INIT_ENCODE )
tif->tif_setupencode(tif);
- if (sp->cstream) {
- ZSTD_freeCStream(sp->cstream);
- sp->cstream = NULL;
- }
- sp->cstream = ZSTD_createCStream();
- if( sp->cstream == NULL ) {
- TIFFErrorExt(tif->tif_clientdata, module,
- "Cannot allocate compression stream");
- return 0;
+ if (sp->cstream == NULL) {
+ sp->cstream = ZSTD_createCStream();
+ if( sp->cstream == NULL ) {
+ TIFFErrorExt(tif->tif_clientdata, module,
+ "Cannot allocate compression stream");
+ return 0;
+ }
}
zstd_ret = ZSTD_initCStream(sp->cstream, sp->compression_level);