crun icon indicating copy to clipboard operation
crun copied to clipboard

status: add cleanup_free

Open eriksjolund opened this issue 10 months ago • 3 comments

The path variable is handled by STEAL_POINTER()

  • https://github.com/containers/crun/blob/d89542c61520ac5c971090dfa3201e9c4ce18ad1/src/libcrun/status.c#L131

but cleanup_freewas missing.

Summary by Sourcery

Bug Fixes:

  • Annotate path with cleanup_free in status.c to prevent potential memory leaks.

eriksjolund avatar Jun 17 '25 05:06 eriksjolund

Reviewer's Guide

Marks the ‘path’ variable with cleanup_free in get_state_directory_status_file to ensure automatic memory cleanup and prevent leaks.

Class diagram for updated memory management in get_state_directory_status_file

classDiagram
    class get_state_directory_status_file {
        - cleanup_free char* root
        - cleanup_free char* path
        - int ret
        + int get_state_directory_status_file(char **out, const char *state_root, const char *id, libcrun_error_t *err)
    }

File-Level Changes

Change Details Files
Added cleanup_free attribute to path variable
  • Updated declaration of path from char * to cleanup_free char *
src/libcrun/status.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Jun 17 '25 05:06 sourcery-ai[bot]

Ephemeral COPR build failed. @containers/packit-build please check.

TMT tests failed. @containers/packit-build please check.