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 with JPN #5

Open
sinukus opened this issue Apr 21, 2016 · 0 comments
Open

Memory leak with JPN #5

sinukus opened this issue Apr 21, 2016 · 0 comments

Comments

@sinukus
Copy link

sinukus commented Apr 21, 2016

Hi,
In:
size_t wjWUTF8CharSize(char *str, size_t length)
{
size_t r = -1;
There is a bug using size_t, in that you check later for -1.
l = wjWUTF8CharSize(e, length - (e - value));
....
else if (l < 0)

We found that using int instead fixes the problem.

std::string wjUTF8Encode(char *value)
{
    size_t  length = strlen(value);
    char        *next;
    char        *v;
    char        *e;
    int l; //<- change to int

And same thing here:

int wjWUTF8CharSize(char *str, size_t length)
{
int r = -1;

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

1 participant