Commit d9503c84 authored by Erik de Castro Lopo's avatar Erik de Castro Lopo
Browse files

libFLAC/md5.c: Clean up allocation

Make sure ctx->capacity gets updated correctly when safe_realloc()
fails.

Patch-from:  lvqcl <lvqcl.mail@gmail.com>
parent 584a1346
......@@ -499,13 +499,12 @@ FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const
return false;
if (ctx->capacity < bytes_needed) {
FLAC__byte *tmp = safe_realloc_(ctx->internal_buf.p8, bytes_needed);
if (0 == tmp) {
if (0 == (ctx->internal_buf.p8 = safe_malloc_(bytes_needed)))
if (0 == (ctx->internal_buf.p8 = safe_realloc_(ctx->internal_buf.p8, bytes_needed))) {
if (0 == (ctx->internal_buf.p8 = safe_malloc_(bytes_needed))) {
ctx->capacity = 0;
return false;
}
else
ctx->internal_buf.p8 = tmp;
}
ctx->capacity = bytes_needed;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment