libfreerdp-client: added method to free addin list

This commit is contained in:
Marc-André Moreau 2012-11-03 23:33:10 -04:00
parent b3f6dea390
commit 5bf0586078
3 changed files with 25 additions and 3 deletions

View File

@ -229,7 +229,8 @@ FREERDP_ADDIN** freerdp_channels_list_client_addins(LPSTR lpName, LPSTR lpSubsys
strncpy(pAddin->cName, p[0], p[1] - p[0] - 1);
pAddin->dwFlags = FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
ppAddins[nAddins++] = pAddin;
@ -246,7 +247,8 @@ FREERDP_ADDIN** freerdp_channels_list_client_addins(LPSTR lpName, LPSTR lpSubsys
strncpy(pAddin->cName, p[0], p[1] - p[0] - 1);
strncpy(pAddin->cSubsystem, p[2], p[3] - p[2] - 1);
pAddin->dwFlags = FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
pAddin->dwFlags |= FREERDP_ADDIN_SUBSYSTEM;
@ -266,7 +268,8 @@ FREERDP_ADDIN** freerdp_channels_list_client_addins(LPSTR lpName, LPSTR lpSubsys
strncpy(pAddin->cSubsystem, p[2], p[3] - p[2] - 1);
strncpy(pAddin->cType, p[3], p[4] - p[3] - 1);
pAddin->dwFlags = FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
pAddin->dwFlags |= FREERDP_ADDIN_NAME;
pAddin->dwFlags |= FREERDP_ADDIN_SUBSYSTEM;
pAddin->dwFlags |= FREERDP_ADDIN_TYPE;
@ -287,6 +290,16 @@ FREERDP_ADDIN** freerdp_channels_list_client_addins(LPSTR lpName, LPSTR lpSubsys
return ppAddins;
}
void freerdp_channels_addin_list_free(FREERDP_ADDIN** ppAddins)
{
int index;
for (index = 0; ppAddins[index] != NULL; index++)
free(ppAddins[index]);
free(ppAddins);
}
struct lib_data
{
PVIRTUALCHANNELENTRY entry; /* the one and only exported function */

View File

@ -22,6 +22,8 @@ int TestClientChannels(int argc, char* argv[])
pAddin->cName, pAddin->cSubsystem, pAddin->cType);
}
freerdp_channels_addin_list_free(ppAddins);
printf("Enumerate rdpsnd\n");
ppAddins = freerdp_channels_list_client_addins("rdpsnd", NULL, NULL, 0);
@ -33,6 +35,8 @@ int TestClientChannels(int argc, char* argv[])
pAddin->cName, pAddin->cSubsystem, pAddin->cType);
}
freerdp_channels_addin_list_free(ppAddins);
printf("Enumerate tsmf video\n");
ppAddins = freerdp_channels_list_client_addins("tsmf", NULL, "video", 0);
@ -44,6 +48,8 @@ int TestClientChannels(int argc, char* argv[])
pAddin->cName, pAddin->cSubsystem, pAddin->cType);
}
freerdp_channels_addin_list_free(ppAddins);
printf("Enumerate unknown\n");
ppAddins = freerdp_channels_list_client_addins("unknown", NULL, NULL, 0);
@ -55,5 +61,7 @@ int TestClientChannels(int argc, char* argv[])
pAddin->cName, pAddin->cSubsystem, pAddin->cType);
}
freerdp_channels_addin_list_free(ppAddins);
return 0;
}

View File

@ -47,6 +47,7 @@ FREERDP_API void* freerdp_channels_client_find_dynamic_entry(const char* name, c
FREERDP_API void* freerdp_channels_client_find_entry(const char* name, const char* identifier);
FREERDP_API FREERDP_ADDIN** freerdp_channels_list_client_addins(LPSTR lpName, LPSTR lpSubsystem, LPSTR lpType, DWORD dwFlags);
FREERDP_API void freerdp_channels_addin_list_free(FREERDP_ADDIN** ppAddins);
#endif /* FREERDP_CHANNELS_CLIENT */