MDEV-28719: compress_write() leaks data_mutex on error
This commit is contained in:
parent
fde99e006d
commit
91d5fffa07
@ -238,25 +238,24 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
|
|||||||
|
|
||||||
xb_a(threads[i].to_len > 0);
|
xb_a(threads[i].to_len > 0);
|
||||||
|
|
||||||
if (ds_write(dest_file, "NEWBNEWB", 8) ||
|
bool fail = ds_write(dest_file, "NEWBNEWB", 8) ||
|
||||||
write_uint64_le(dest_file,
|
write_uint64_le(dest_file,
|
||||||
comp_file->bytes_processed)) {
|
comp_file->bytes_processed);
|
||||||
msg("compress: write to the destination stream "
|
|
||||||
"failed.");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
comp_file->bytes_processed += threads[i].from_len;
|
comp_file->bytes_processed += threads[i].from_len;
|
||||||
|
|
||||||
if (write_uint32_le(dest_file, threads[i].adler) ||
|
if (!fail) {
|
||||||
ds_write(dest_file, threads[i].to,
|
fail = write_uint32_le(dest_file, threads[i].adler) ||
|
||||||
threads[i].to_len)) {
|
ds_write(dest_file, threads[i].to,
|
||||||
msg("compress: write to the destination stream "
|
threads[i].to_len);
|
||||||
"failed.");
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_unlock(&threads[i].data_mutex);
|
pthread_mutex_unlock(&threads[i].data_mutex);
|
||||||
|
|
||||||
|
if (fail) {
|
||||||
|
msg("compress: write to the destination stream "
|
||||||
|
"failed.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user