Merged in malloc_check (pull request #6)
Small fix to check the return code when malloc'ing temporary buffers.
This commit is contained in:
commit
047bcf5330
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue