commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 02/07: digital: Fix alloc bug in HDLC defra


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/07: digital: Fix alloc bug in HDLC deframer and make Coverity happy.
Date: Fri, 16 May 2014 23:49:30 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit c655a681f6ed6f3153fe35257819597625adf0b9
Author: Nick Foster <address@hidden>
Date:   Mon May 12 09:58:53 2014 -0700

    digital: Fix alloc bug in HDLC deframer and make Coverity happy.
---
 gr-digital/lib/hdlc_deframer_bp_impl.cc | 6 ++++--
 1 file 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 12d7ec6..0723ad4 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 {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]