Skip to content

Commit

Permalink
Revert "Fix memory leak in decode_webp (#8712)" (#8723)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug authored Nov 12, 2024
1 parent cb9fdbf commit 7d077f1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions torchvision/csrc/io/image/cpu/decode_webp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ torch::Tensor decode_webp(

auto decoded_data =
decoding_func(encoded_data_p, encoded_data_size, &width, &height);

TORCH_CHECK(decoded_data != nullptr, "WebPDecodeRGB[A] failed.");

auto deleter = [decoded_data](void*) { WebPFree(decoded_data); };
auto out = torch::from_blob(
decoded_data, {height, width, num_channels}, deleter, torch::kUInt8);
decoded_data, {height, width, num_channels}, torch::kUInt8);

return out.permute({2, 0, 1});
}
Expand Down

0 comments on commit 7d077f1

Please sign in to comment.