Skip to content

Commit

Permalink
Merge pull request #4050 from Adenilson/fix_legacy_nullptr01
Browse files Browse the repository at this point in the history
[fix] Add check on failed allocation in legacy/zstd_v06
  • Loading branch information
Cyan4973 authored May 21, 2024
2 parents 78955f5 + 1872688 commit 0e2ceb2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/legacy/zstd_v06.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0e2ceb2

Please sign in to comment.