Commit ffd94cd3 authored by Sergio Ammirata's avatar Sergio Ammirata
Browse files

Fix bug and remove message on alloc error

parent 825b6d96
......@@ -184,13 +184,12 @@ static block_t *BlockRIST(stream_t *p_access, bool *restrict eof)
// Prepare one large buffer (when we are behing in reading, otherwise it is the same size as what is being read)
pktout = block_Alloc(i_total_size);
if (!pktout) {
msg_Err(p_access, "Couldn't allocate block");
if ( unlikely(pktout == NULL) ) {
goto failed_cleanup;
}
size_t block_offset = 0;
for(size_t i = 0; i <= i_rist_items_index; ++i) {
for(size_t i = 0; i < i_rist_items_index; ++i) {
memcpy(pktout->p_buffer + block_offset, p_sys->rist_items[i]->payload, p_sys->rist_items[i]->payload_len);
block_offset += p_sys->rist_items[i]->payload_len;
rist_receiver_data_block_free2(& p_sys->rist_items[i]);
......@@ -200,7 +199,7 @@ static block_t *BlockRIST(stream_t *p_access, bool *restrict eof)
failed_cleanup:
if (i_total_size > 0) {
for (size_t i = 0; i <= i_rist_items_index; i++) {
for (size_t i = 0; i < i_rist_items_index; i++) {
rist_receiver_data_block_free2(&p_sys->rist_items[i]);
}
}
......
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