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 leaks in DispatchEvents.cpp. #43

Closed
EJP286CRSKW opened this issue Oct 3, 2023 · 2 comments
Closed

Memory leaks in DispatchEvents.cpp. #43

EJP286CRSKW opened this issue Oct 3, 2023 · 2 comments

Comments

@EJP286CRSKW
Copy link

There are several GetStringUTFChars() calls in this file that are followed by comments asking whether this result needs to be released, by ReleaseStringUTFChars().

The answer is yes, they do need to be released.

@EJP286CRSKW EJP286CRSKW changed the title Memory leask in DispatchEvents.cpp. Memory leaks in DispatchEvents.cpp. Oct 3, 2023
@freemansoft
Copy link
Owner

So they become

BSTR typeLib = NULL;
    if (_typelib != NULL)
    {
      // why is this UTF instead of unicode? Then we could probably drop the A2W
      const char *typelib = env->GetStringUTFChars(_typelib, NULL);
      typeLib = A2W(typelib);
      env->ReleaseStringUTFChars(_typelib, typelib);

      // printf("we have a type lib %ls\n",typeLib);
    }

    // find progid if any
    LPOLESTR bsProgId = NULL;
    if (_progid != NULL)
    {
      // why is this UTF instead of unicode?  Then we could probably drop the A2W
      const char *progid = env->GetStringUTFChars(_progid, NULL);
      bsProgId = A2W(progid);
      env->ReleaseStringUTFChars(_progid, progid)
      // printf("we have an applicaton %ls\n",bsProgId);
    }

@freemansoft
Copy link
Owner

27eff92

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