Elektrine lite

← Feed

@doragasu@mastodon.sdf.org

Post #1232029

2026-04-01 11:38 UTC

@bodil I never use these tools, but yesterday I was using libcbor for the first time and decided giving chatgpt a try to generate a small snippet to decode a simple structure. It introduced two memory leaks (didn't call cbor_decref() on extra references it created). Told it if it shouldn't be calling cbor_decref() on those, and it confidently said you must not because those references were borrowed (wrong, and the documentation states clearly they aren't 🤷‍♂️).

Replies (1)

  • @doragasu@mastodon.sdf.org 2026-04-01 11:42

    @bodil It introducing memory leaks is specially bad, because the code "will work", but the leaks will cause problems in the future, when you are not debugging that code anymore. Yeah, slop is slop after all.

    Open ##1232030