Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Leak in kubeyaml_load_kubeconfig() in kubernetes/config/kube_config_yaml.c #134

Closed
hariramshankar opened this issue Aug 17, 2022 · 5 comments · Fixed by #169
Closed

Comments

@hariramshankar
Copy link

Hi,

I found a memory leak when calling kubeyaml_load_kubeconfig()

kubeyaml_load_kubeconfig creates a yaml parser object before attempting to read the kubeconfig file.

If opening the kubeconfig file failed for some reason, the function returns(-1) without freeing up the memory allocated to parser.

snippet of the code in question where the leak occurs

    /* Create the Parser object. */
    yaml_parser_initialize(&parser);

    /* Set a file input. */
    FILE *input = NULL;
    if (kubeconfig->fileName) {
        input = fopen(kubeconfig->fileName, "rb");
        if (!input) {
            fprintf(stderr, "%s: Cannot open the file %s.[%s]\n", fname, kubeconfig->fileName, strerror(errno));
            return -1; <<<<<
        }
    } else {
        fprintf(stderr, "%s: The kubeconf file name needs be set by kubeconfig->fileName .\n", fname);
        return -1; <<<<<
    }
@ityuhui
Copy link
Member

ityuhui commented Aug 18, 2022

Thank you for reporting this issue.

Will fix it later.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 16, 2022
@ityuhui
Copy link
Member

ityuhui commented Nov 16, 2022

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 16, 2022
@joyanta55
Copy link

joyanta55 commented Jan 12, 2023

Any update on this? I experienced the same.

@ityuhui
Copy link
Member

ityuhui commented Jan 13, 2023

I'll find a cycle to fix it in a few days.
Fix PRs from anyone are also welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants