@@ -630,7 +630,7 @@ int HCIClass::sendAclPkt(uint16_t handle, uint8_t cid, uint8_t plen, void* data)
630
630
uint16_t cid;
631
631
} aclHdr = { HCI_ACLDATA_PKT, handle, uint8_t (plen + 4 ), plen, cid };
632
632
633
- uint8_t txBuffer[ sizeof (aclHdr) + plen] ;
633
+ uint8_t * txBuffer = uint8_t * malloc ( sizeof (aclHdr) + plen) ;
634
634
memcpy (txBuffer, &aclHdr, sizeof (aclHdr));
635
635
memcpy (&txBuffer[sizeof (aclHdr)], data, plen);
636
636
@@ -648,7 +648,8 @@ int HCIClass::sendAclPkt(uint16_t handle, uint8_t cid, uint8_t plen, void* data)
648
648
649
649
_pendingPkt++;
650
650
HCITransport.write (txBuffer, sizeof (aclHdr) + plen);
651
-
651
+ free (txBuffer);
652
+
652
653
return 0 ;
653
654
}
654
655
@@ -680,7 +681,7 @@ int HCIClass::sendCommand(uint16_t opcode, uint8_t plen, void* parameters)
680
681
uint8_t plen;
681
682
} pktHdr = {HCI_COMMAND_PKT, opcode, plen};
682
683
683
- uint8_t txBuffer[ sizeof (pktHdr) + plen] ;
684
+ uint8_t * txBuffer = uint8_t * malloc ( sizeof (pktHdr) + plen) ;
684
685
memcpy (txBuffer, &pktHdr, sizeof (pktHdr));
685
686
memcpy (&txBuffer[sizeof (pktHdr)], parameters, plen);
686
687
@@ -705,6 +706,8 @@ int HCIClass::sendCommand(uint16_t opcode, uint8_t plen, void* parameters)
705
706
poll ();
706
707
}
707
708
709
+ free (txBuffer);
710
+
708
711
return _cmdCompleteStatus;
709
712
}
710
713
0 commit comments