Skip to content
Snippets Groups Projects
Commit 08fa3a76 authored by Gregory Szorc's avatar Gregory Szorc
Browse files

zstd: prevent potential free() of uninitialized memory

This is a cherry pick of an upstream fix. The free() of uninitialed
memory could likely only occur if a malloc() inside zstd fails.

The patched functions aren't currently used by Mercurial. But I don't
like leaving footguns sitting around.
parent 08b34c3a
No related branches found
No related tags found
No related merge requests found
......@@ -258,6 +258,9 @@
return NULL;
}
/* Prevent free on uninitialized memory in finally. */
output.dst = NULL;
cstream = CStream_from_ZstdCompressor(self, sourceSize);
if (!cstream) {
res = NULL;
......
......@@ -165,6 +165,9 @@
return NULL;
}
/* Prevent free on uninitialized memory in finally. */
output.dst = NULL;
dstream = DStream_from_ZstdDecompressor(self);
if (!dstream) {
res = NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment