summaryrefslogtreecommitdiff
path: root/src/erasurecode_preprocessing.c
diff options
context:
space:
mode:
authorMark Storer <Mark.Storer@evault.com>2014-10-01 10:05:59 -0400
committerMark Storer <Mark.Storer@evault.com>2014-10-01 10:05:59 -0400
commit42870dff1f80e635d417ee1e83572d213f87f74c (patch)
tree8b1c8272dfa9b4c068254fcabb7deee2d4662b93 /src/erasurecode_preprocessing.c
parent3c7d0dec0205e3d322e05116e16389dae8e20c6e (diff)
downloadliberasurecode-42870dff1f80e635d417ee1e83572d213f87f74c.tar.gz
Small fix to check the return code when malloc'ing temporary buffers.
Diffstat (limited to 'src/erasurecode_preprocessing.c')
-rw-r--r--src/erasurecode_preprocessing.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/erasurecode_preprocessing.c b/src/erasurecode_preprocessing.c
index c3e5ed6..62134ba 100644
--- a/src/erasurecode_preprocessing.c
+++ b/src/erasurecode_preprocessing.c
@@ -143,6 +143,10 @@ int prepare_fragments_for_decode(
*realloc_bm = *realloc_bm | (1 << i);
} else if (!is_addr_aligned((unsigned long)data[i], 16)) {
char *tmp_buf = alloc_fragment_buffer(fragment_size - sizeof(fragment_header_t));
+ if (NULL == tmp_buf) {
+ log_error("Could not allocate temp buffer!");
+ return -1;
+ }
memcpy(tmp_buf, data[i], fragment_size);
data[i] = tmp_buf;
*realloc_bm = *realloc_bm | (1 << i);
@@ -178,6 +182,10 @@ int prepare_fragments_for_decode(
*realloc_bm = *realloc_bm | (1 << (k + i));
} else if (!is_addr_aligned((unsigned long)parity[i], 16)) {
char *tmp_buf = alloc_fragment_buffer(fragment_size-sizeof(fragment_header_t));
+ if (NULL == tmp_buf) {
+ log_error("Could not allocate temp buffer!");
+ return -1;
+ }
memcpy(tmp_buf, parity[i], fragment_size);
parity[i] = tmp_buf;
*realloc_bm = *realloc_bm | (1 << (k + i));