dloebl / cgif

GIF encoder written in C
MIT License
113 stars 15 forks source link

Small memory leak when calling cgif_close() without having called cgif_addframe() #40

Closed inkmeister closed 2 years ago

inkmeister commented 2 years ago

There appears to be a small memory leak when cgif_close is called without first adding a frame by calling cgif_addframe. It appears cgif_close will skip some cleanups when pGIF->CurResult is != CGIF_OK. In this case, it’s CGIF_PENDING and so pGIF doesn’t get freed within cgif_raw_close. I appreciate this isn’t the most typical use case for cgif, but it is possible for it to happen in my application if it has to close down before having had chance to add a frame. Thanks for a great library.

dloebl commented 2 years ago

Hi @inkmeister. Thanks for pointing out this issue. I've added a test case/fix for this in #41.

inkmeister commented 2 years ago

Hi Daniel,

No problem. Thanks for the quick turnaround.

Mark.


From: Daniel Löbl @.> Sent: 06 February 2022 20:35 To: dloebl/cgif @.> Cc: inkmeister @.>; Mention @.> Subject: Re: [dloebl/cgif] Small memory leak when calling cgif_close() without having called cgif_addframe() (Issue #40)

Hi @inkmeisterhttps://github.com/inkmeister. Thanks for pointing out this issue. I've added a test case/fix for this in #41https://github.com/dloebl/cgif/pull/41.

— Reply to this email directly, view it on GitHubhttps://github.com/dloebl/cgif/issues/40#issuecomment-1030909142, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALDTAO54ONAL4RNQFDCN6GDUZ3LRLANCNFSM5NVIVS6Q. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.***>