Commit 251267f9 authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Proper initialization in block decoding.

parent ba9d6c5b
...@@ -162,6 +162,8 @@ void PrrtBlock_encode(PrrtBlock *block_ptr, uint16_t *seqno) ...@@ -162,6 +162,8 @@ void PrrtBlock_encode(PrrtBlock *block_ptr, uint16_t *seqno)
void PrrtBlock_decode(PrrtBlock *block_ptr) void PrrtBlock_decode(PrrtBlock *block_ptr)
{ {
int i, j = 0; int i, j = 0;
gf **fec = NULL;
int *idx_p = NULL;
uint8_t n = block_ptr->codingParams.n; uint8_t n = block_ptr->codingParams.n;
uint8_t k = block_ptr->codingParams.k; uint8_t k = block_ptr->codingParams.k;
...@@ -171,13 +173,13 @@ void PrrtBlock_decode(PrrtBlock *block_ptr) ...@@ -171,13 +173,13 @@ void PrrtBlock_decode(PrrtBlock *block_ptr)
PrrtCoder_get_coder(&coder, n, k); PrrtCoder_get_coder(&coder, n, k);
gf **fec = calloc(n, sizeof(gf *)); fec = calloc(n, sizeof(gf *));
check_mem(fec); check_mem(fec);
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
fec[i] = calloc(block_ptr->largestDataLength, sizeof(gf)); fec[i] = calloc(block_ptr->largestDataLength, sizeof(gf));
} }
int *idx_p = calloc(k, sizeof(int)); idx_p = calloc(k, sizeof(int));
check_mem(idx_p); check_mem(idx_p);
gather_redundancy_packets(block_ptr, fec, idx_p); gather_redundancy_packets(block_ptr, fec, idx_p);
...@@ -194,8 +196,12 @@ void PrrtBlock_decode(PrrtBlock *block_ptr) ...@@ -194,8 +196,12 @@ void PrrtBlock_decode(PrrtBlock *block_ptr)
PrrtCoder_destroy(coder); PrrtCoder_destroy(coder);
clear_list(fec, n); clear_list(fec, n);
free(fec); if(fec != NULL) {
free(idx_p); free(fec);
}
if(idx_p != NULL) {
free(idx_p);
}
} }
PrrtPacket *PrrtBlock_get_first_red_data(PrrtBlock *block_ptr) PrrtPacket *PrrtBlock_get_first_red_data(PrrtBlock *block_ptr)
......
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