Free device info list.

This commit is contained in:
2019-10-13 14:11:54 +01:00
parent 9d1b0d7670
commit 71ba668c44
3 changed files with 19 additions and 1 deletions

View File

@@ -82,5 +82,6 @@ typedef struct DeviceInfoList
#pragma pack(pop) #pragma pack(pop)
DeviceInfoList* ListDevices(); DeviceInfoList* ListDevices();
void FreeDeviceInfoList(DeviceInfoList* start);
#endif #endif

View File

@@ -21,11 +21,26 @@
#include "linux/linux.h" #include "linux/linux.h"
#endif #endif
#include <stddef.h>
#include <stdlib.h>
DeviceInfoList* ListDevices() DeviceInfoList* ListDevices()
{ {
#if defined(__linux__) && !defined(__ANDROID__) #if defined(__linux__) && !defined(__ANDROID__)
return linux_list_devices(); return linux_list_devices();
#else #else
return 0; return NULL;
#endif #endif
}
void FreeDeviceInfoList(DeviceInfoList* start)
{
DeviceInfoList* current;
while(start)
{
current = start;
start = current->next;
free(current);
}
} }

2
main.c
View File

@@ -317,6 +317,8 @@ int main()
continue; continue;
} }
FreeDeviceInfoList(deviceInfoList);
printf("List devices not yet implemented, skipping...\n"); printf("List devices not yet implemented, skipping...\n");
continue; continue;
case DICMOTE_PACKET_TYPE_RESPONSE_LIST_DEVICES: case DICMOTE_PACKET_TYPE_RESPONSE_LIST_DEVICES: