summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Foster <bistromath@gmail.com>2014-05-12 09:58:53 -0700
committerNick Foster <bistromath@gmail.com>2014-05-12 09:58:53 -0700
commitc655a681f6ed6f3153fe35257819597625adf0b9 (patch)
tree65b30225bee354a35e2a5fcf2098156bfa433dda
parent432e3b75300a400e2e99dbe7e9aea58b6b2855b1 (diff)
digital: Fix alloc bug in HDLC deframer and make Coverity happy.
-rw-r--r--gr-digital/lib/hdlc_deframer_bp_impl.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/gr-digital/lib/hdlc_deframer_bp_impl.cc b/gr-digital/lib/hdlc_deframer_bp_impl.cc
index 12d7ec66bc..0723ad473e 100644
--- a/gr-digital/lib/hdlc_deframer_bp_impl.cc
+++ b/gr-digital/lib/hdlc_deframer_bp_impl.cc
@@ -64,6 +64,7 @@ namespace gr {
*/
hdlc_deframer_bp_impl::~hdlc_deframer_bp_impl()
{
+ delete[] d_pktbuf;
}
unsigned int
@@ -94,12 +95,13 @@ namespace gr {
if(bit) { //six ones is a frame delimiter
if(d_bytectr >= d_length_min) {
//check CRC, publish frame
+ int len = d_bytectr - 2; //make Coverity happy
unsigned short crc = d_pktbuf[d_bytectr-1] << 8
| d_pktbuf[d_bytectr-2];
- unsigned short calc_crc = crc_ccitt(d_pktbuf, d_bytectr-2);
+ unsigned short calc_crc = crc_ccitt(d_pktbuf, len);
if (crc==calc_crc) {
pmt::pmt_t pdu(pmt::cons(pmt::PMT_NIL,
- pmt::make_blob(&d_pktbuf[0], d_bytectr-2)));
+ pmt::make_blob(d_pktbuf, len)));
message_port_pub(pmt::mp("out"), pdu);
}
else {