--- a/apps/dtnrespond/dtnrespond.c Wed Jan 11 17:25:15 2012 +0000
+++ b/apps/dtnrespond/dtnrespond.c Wed Jan 11 18:10:26 2012 +0000
@@ -798,6 +798,14 @@
}
i += f_decoding_len;
+ if ( bpq->fragments.num_frag_returned > 0 ) {
+ bpq->fragments.frag_offsets = (u_int*) malloc ( sizeof(u_int) * bpq->fragments.num_frag_returned );
+ bpq->fragments.frag_lenghts = (u_int*) malloc ( sizeof(u_int) * bpq->fragments.num_frag_returned );
+ } else {
+ bpq->fragments.frag_offsets = NULL;
+ bpq->fragments.frag_lenghts = NULL;
+ }
+
for (j=0; i<buf_len && j<(int)bpq->fragments.num_frag_returned; ++j) {
// fragment offsets SDNV
@@ -1042,6 +1050,18 @@
dtn_free_payload(&payload);
}
+ // if fragment memory was allocated
+ // free it now
+ if ( bpq_block_data.fragments.frag_offsets != NULL ){
+ free(bpq_block_data.fragments.frag_offsets);
+ bpq_block_data.fragments.frag_offsets = NULL;
+ }
+
+ if ( bpq_block_data.fragments.frag_lenghts != NULL ){
+ free(bpq_block_data.fragments.frag_lenghts);
+ bpq_block_data.fragments.frag_lenghts = NULL;
+ }
+
return ret;
}