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

meminfo_escape_for_json memory leak #30

Closed
dhopkalo opened this issue Sep 24, 2016 · 1 comment
Closed

meminfo_escape_for_json memory leak #30

dhopkalo opened this issue Sep 24, 2016 · 1 comment

Comments

@dhopkalo
Copy link
Contributor

dhopkalo commented Sep 24, 2016

Hello,

char * meminfo_escape_for_json(const char *s)
{
    int new_str_len;
    char *s1;

    s1 = php_str_to_str(s, strlen(s), "\\", 1, "\\\\", 2, &new_str_len);

    return  php_str_to_str(s1, strlen(s1), "\"", 1, "\\\"", 2, &new_str_len);
}

php_str_to_str allocates a new char * in memory that doesn't clear after.

pls see my tests that determine this problem:
#27

and my solution to it
#28

Thanks.

@BitOne
Copy link
Owner

BitOne commented Nov 17, 2017

Thanks, your solution has been merged and applied at other places too ;)

@BitOne BitOne closed this as completed Nov 17, 2017
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

No branches or pull requests

2 participants