@@ -427,7 +427,7 @@ int HCIClass::sendAclPkt(uint16_t handle, uint8_t cid, uint8_t plen, void* data)
427
427
uint16_t cid;
428
428
} aclHdr = { HCI_ACLDATA_PKT, handle, uint8_t (plen + 4 ), plen, cid };
429
429
430
- uint8_t txBuffer[ sizeof (aclHdr) + plen] ;
430
+ uint8_t * txBuffer = uint8_t * malloc ( sizeof (aclHdr) + plen) ;
431
431
memcpy (txBuffer, &aclHdr, sizeof (aclHdr));
432
432
memcpy (&txBuffer[sizeof (aclHdr)], data, plen);
433
433
@@ -437,7 +437,8 @@ int HCIClass::sendAclPkt(uint16_t handle, uint8_t cid, uint8_t plen, void* data)
437
437
438
438
_pendingPkt++;
439
439
HCITransport.write (txBuffer, sizeof (aclHdr) + plen);
440
-
440
+ free (txBuffer);
441
+
441
442
return 0 ;
442
443
}
443
444
@@ -469,7 +470,7 @@ int HCIClass::sendCommand(uint16_t opcode, uint8_t plen, void* parameters)
469
470
uint8_t plen;
470
471
} pktHdr = {HCI_COMMAND_PKT, opcode, plen};
471
472
472
- uint8_t txBuffer[ sizeof (pktHdr) + plen] ;
473
+ uint8_t * txBuffer = uint8_t * malloc ( sizeof (pktHdr) + plen) ;
473
474
memcpy (txBuffer, &pktHdr, sizeof (pktHdr));
474
475
memcpy (&txBuffer[sizeof (pktHdr)], parameters, plen);
475
476
@@ -486,6 +487,8 @@ int HCIClass::sendCommand(uint16_t opcode, uint8_t plen, void* parameters)
486
487
poll ();
487
488
}
488
489
490
+ free (txBuffer);
491
+
489
492
return _cmdCompleteStatus;
490
493
}
491
494
0 commit comments