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

JSON parser handle is not released #1201

Closed
eff7 opened this issue Aug 22, 2016 · 3 comments
Closed

JSON parser handle is not released #1201

eff7 opened this issue Aug 22, 2016 · 3 comments
Assignees
Labels
2.x Related to ModSecurity version 2.x
Milestone

Comments

@eff7
Copy link

eff7 commented Aug 22, 2016

Hello,

when using ModSecurity with JSON parsing enabled, we identified a significant memory leak.

It appears that when using the JSON parser to parse request body, a yajl handle is allocated using yajl_alloc, but is never reased. The function json_cleanup in msc_json.c does not clean up anything.

the suggested fix is below: (in apache2/msc_json.c line 308)

/**
 * Frees the resources used for JSON parsing.
 */
apr_status_t json_cleanup(modsec_rec *msr) {
    msr_log(msr, 4, "JSON: Cleaning up JSON results");
    if (msr->json->handle != NULL) {
        yajl_free(msr->json->handle);
        msr->json->handle = NULL;
    }

    return 1;
}

Thanks

@zimmerle zimmerle self-assigned this Aug 25, 2016
@zimmerle zimmerle added this to the v2.9.2 milestone Aug 25, 2016
@zimmerle zimmerle added the 2.x Related to ModSecurity version 2.x label Aug 25, 2016
@zimmerle
Copy link
Contributor

Hi @eff7,

Thank you! Do you want to send it in a format of a pull request?

@eff7
Copy link
Author

eff7 commented Aug 28, 2016

@zimmerle created pull request.

@zimmerle
Copy link
Contributor

@eff7

Thanks!

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

No branches or pull requests

2 participants