[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 01/01: fec: fixing a bit of sloppy memory h
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 01/01: fec: fixing a bit of sloppy memory handling in the cc decoder. |
Date: |
Wed, 21 May 2014 16:10:12 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
trondeau pushed a commit to branch master
in repository gnuradio.
commit cba2d184e2abb8a52353929a34b562ea4f9bd031
Author: Tom Rondeau <address@hidden>
Date: Wed May 21 12:09:07 2014 -0400
fec: fixing a bit of sloppy memory handling in the cc decoder.
---
gr-fec/lib/cc_decoder_impl.cc | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/gr-fec/lib/cc_decoder_impl.cc b/gr-fec/lib/cc_decoder_impl.cc
index 6739f7b..4657d16 100644
--- a/gr-fec/lib/cc_decoder_impl.cc
+++ b/gr-fec/lib/cc_decoder_impl.cc
@@ -83,9 +83,9 @@ namespace gr {
switch(d_mode) {
case(CC_TAILBITING):
d_end_state = &d_end_state_chaining;
+ d_veclen = d_frame_size + (6 * (d_k - 1));
d_managed_in = (unsigned
char*)volk_malloc(d_veclen*d_rate*sizeof(unsigned char),
volk_get_alignment());
- d_veclen = d_frame_size + (6 * (d_k - 1));
d_managed_in_size = d_veclen * d_rate;
if(d_managed_in == NULL) {
throw std::runtime_error("cc_decoder: bad alloc for
d_managed_in\n");
@@ -120,7 +120,7 @@ namespace gr {
d_vp->metrics1.t = d_vp->metrics;
d_vp->metrics2.t = d_vp->metrics + d_numstates;
- d_vp->decisions = (unsigned
char*)volk_malloc(d_veclen*d_decision_t_size,
+ d_vp->decisions = (unsigned char*)volk_malloc(sizeof(unsigned
char)*d_veclen*d_decision_t_size,
volk_get_alignment());
if(d_vp->decisions == NULL) {
throw std::runtime_error("bad alloc for d_vp->decisions!\n");
@@ -160,9 +160,13 @@ namespace gr {
cc_decoder_impl::~cc_decoder_impl()
{
- free(d_vp->decisions);
- free(Branchtab);
- free(d_vp->metrics);
+ volk_free(d_vp->decisions);
+ volk_free(Branchtab);
+ volk_free(d_vp->metrics);
+
+ if(d_mode == CC_TAILBITING) {
+ volk_free(d_managed_in);
+ }
}
int