discord / lilliput

Resize images and animated GIFs in Go
https://discord.com/blog/how-discord-resizes-150-million-images-every-day-with-go-and-c
Other
1.94k stars 124 forks source link

Unreachable code in thumbhash_encoder_create function #129

Open skidder opened 11 months ago

skidder commented 11 months ago

The thumbhash_encoder_create function includes a null-check on the return value from new; however, if new were to fail, the default behavior is to throw an std::bad_alloc exception rather than return null, making the if-condition unreachable.

https://github.com/discord/lilliput/blob/217a9d5cff47a3310851f1f9239df962c5b2c1bd/thumbhash.cpp#L18-L21