diff --git a/crt/aws-crt-cpp b/crt/aws-crt-cpp index faf2cabe0..1a551c7bc 160000 --- a/crt/aws-crt-cpp +++ b/crt/aws-crt-cpp @@ -1 +1 @@ -Subproject commit faf2cabe0abe92b5c7e1dc62ccc3f3d0d16a92fc +Subproject commit 1a551c7bc8b1b1ca29ac5288eeade6c4a4d59b0e diff --git a/samples/mqtt/basic_pub_sub/main.cpp b/samples/mqtt/basic_pub_sub/main.cpp index 24b0eec17..2754ff45e 100644 --- a/samples/mqtt/basic_pub_sub/main.cpp +++ b/samples/mqtt/basic_pub_sub/main.cpp @@ -540,12 +540,9 @@ int main(int argc, char *argv[]) break; } - ByteBuf payload = ByteBufNewCopy(DefaultAllocator(), (const uint8_t *)input.data(), input.length()); - ByteBuf *payloadPtr = &payload; - - auto onPublishComplete = [payloadPtr](Mqtt::MqttConnection &, uint16_t packetId, int errorCode) { - aws_byte_buf_clean_up(payloadPtr); + ByteBuf payload = ByteBufFromArray((const uint8_t *)input.data(), input.length()); + auto onPublishComplete = [](Mqtt::MqttConnection &, uint16_t packetId, int errorCode) { if (packetId) { fprintf(stdout, "Operation on packetId %d Succeeded\n", packetId); diff --git a/samples/mqtt/raw_pub_sub/main.cpp b/samples/mqtt/raw_pub_sub/main.cpp index 7262edde5..0a39efabc 100644 --- a/samples/mqtt/raw_pub_sub/main.cpp +++ b/samples/mqtt/raw_pub_sub/main.cpp @@ -413,12 +413,9 @@ int main(int argc, char *argv[]) break; } - ByteBuf payload = ByteBufNewCopy(DefaultAllocator(), (const uint8_t *)input.data(), input.length()); - ByteBuf *payloadPtr = &payload; - - auto onPublishComplete = [payloadPtr](Mqtt::MqttConnection &, uint16_t packetId, int errorCode) { - aws_byte_buf_clean_up(payloadPtr); + ByteBuf payload = ByteBufFromArray((const uint8_t *)input.data(), input.length()); + auto onPublishComplete = [](Mqtt::MqttConnection &, uint16_t packetId, int errorCode) { if (packetId) { fprintf(stdout, "Operation on packetId %d Succeeded\n", packetId);