You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using ServiceNotificationMethodViaMessages I've got memory leak with instance ofTRestClientUriServiceNotification hanging.
In procedure TRestClientUri.InternalNotificationMethodExecute
sub-procedure procedure Call(methodIndex: integer; const par: RawUtf8; res: TJsonWriter);
execmsg variable is not freed, so I think it should be :
...
execmsg := TRestClientUriServiceNotification.Create(
callback.Factory, method, []);
try // gigo
execmsg.fOwner := self;
execmsg.fInstance := callback.Instance;
execmsg.fPar := par;
with fServiceNotificationMethodViaMessages do
ok := PostMessage(Wnd, Msg, Wnd, PtrInt(execmsg));
if ok then
exit;
finally // gigo
execmsg.Free; // gigo
end; // gigo
...
The text was updated successfully, but these errors were encountered:
I don't think so: execmsg is passed as a pointer to POstMessage() and is to be released by the message handler itself in TRestClientUri.ServiceNotificationMethodExecute.
Your modification will create a dangling pointer, and is likely to randomly GPF: you free the instance, but the message handler will use it. It won't work in the message handler, especially because fPar is ''.
When using ServiceNotificationMethodViaMessages I've got memory leak with instance ofTRestClientUriServiceNotification hanging.
In procedure TRestClientUri.InternalNotificationMethodExecute
sub-procedure procedure Call(methodIndex: integer; const par: RawUtf8; res: TJsonWriter);
execmsg variable is not freed, so I think it should be :
The text was updated successfully, but these errors were encountered: