There are some differences in the errors handling between the server and non-server modes.
For the server case, there is the fragment labeled with handleError:
if (isServer) {
. . .
handleError:
jvmtiDeallocate(info->name);
jvmtiDeallocate(info->address);
jvmtiDeallocate(info->allowed_peers);
jvmtiDeallocate(info);
} else {
...
However, a similar fragment is missed in the 'else' statement (non-server mode).
Also, it looks like the TransportInfo* info is not deallocated in non-error case,
so that it is going to be leaked when the current agent session is completed.
As multiple sessions are not currently supported then it would make sense to consider making the TransportInfo* info to be static.
For the server case, there is the fragment labeled with handleError:
if (isServer) {
. . .
handleError:
jvmtiDeallocate(info->name);
jvmtiDeallocate(info->address);
jvmtiDeallocate(info->allowed_peers);
jvmtiDeallocate(info);
} else {
...
However, a similar fragment is missed in the 'else' statement (non-server mode).
Also, it looks like the TransportInfo* info is not deallocated in non-error case,
so that it is going to be leaked when the current agent session is completed.
As multiple sessions are not currently supported then it would make sense to consider making the TransportInfo* info to be static.