From dd73e6810286bce191ec4e0da7c167ec828120ff Mon Sep 17 00:00:00 2001 From: Kostiantyn Melnik Date: Thu, 26 Dec 2024 14:51:51 +0200 Subject: [PATCH] Bugfix: unchecked pointer use --- tensorflow/lite/micro/micro_allocator.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tensorflow/lite/micro/micro_allocator.cc b/tensorflow/lite/micro/micro_allocator.cc index eee24eb195d..21a348ef748 100644 --- a/tensorflow/lite/micro/micro_allocator.cc +++ b/tensorflow/lite/micro/micro_allocator.cc @@ -875,7 +875,8 @@ TfLiteTensor* MicroAllocator::AllocateTempTfLiteTensor( // Populate any fields from the flatbuffer, since this TfLiteTensor struct is // allocated in the temp section of the arena, ensure that additional // allocations also take place in that section of the arena. - if (PopulateTfLiteTensorFromFlatbuffer(model, tensor, tensor_index, + if (nullptr == tensor || + PopulateTfLiteTensorFromFlatbuffer(model, tensor, tensor_index, subgraph_index, /*allocate_temp=*/true) != kTfLiteOk) { MicroPrintf(