Merge "Fix reconstruct to return an error when memory allocation failed"

This commit is contained in:
Jenkins 2016-11-24 00:18:08 +00:00 committed by Gerrit Code Review
commit 0a79a4889e
1 changed files with 3 additions and 0 deletions

View File

@ -812,18 +812,21 @@ int liberasurecode_reconstruct_fragment(int desc,
data = alloc_zeroed_buffer(sizeof(char*) * k);
if (NULL == data) {
log_error("Could not allocate data buffer!");
ret = -ENOMEM;
goto out;
}
parity = alloc_zeroed_buffer(sizeof(char*) * m);
if (NULL == parity) {
log_error("Could not allocate parity buffer!");
ret = -ENOMEM;
goto out;
}
missing_idxs = alloc_and_set_buffer(sizeof(int*) * (k + m), -1);
if (NULL == missing_idxs) {
log_error("Could not allocate missing_idxs buffer!");
ret = -ENOMEM;
goto out;
}