Merge pull request #4050 from Adenilson/fix_legacy_nullptr01

[fix] Add check on failed allocation in legacy/zstd_v06
This commit is contained in:
Yann Collet
2024-05-21 10:30:45 -07:00
committed by GitHub
+4
View File
@@ -3919,6 +3919,10 @@ ZBUFFv06_DCtx* ZBUFFv06_createDCtx(void)
if (zbd==NULL) return NULL;
memset(zbd, 0, sizeof(*zbd));
zbd->zd = ZSTDv06_createDCtx();
if (zbd->zd==NULL) {
ZBUFFv06_freeDCtx(zbd); /* avoid leaking the context */
return NULL;
}
zbd->stage = ZBUFFds_init;
return zbd;
}