aboutsummaryrefslogtreecommitdiffstats
path: root/libgamepad_close_superdevice.c
blob: dc212bded89fa4faa1df782951bf7642c2966dff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* See LICENSE file for copyright and license details. */
#include "common.h"


void
libgamepad_close_superdevice(struct libgamepad_superdevice *device)
{
	if (device) {
		free(device->syspath);
		while (device->ndevices)
			free(device->devices[--device->ndevices]);
		free(device->devices);
		while (device->nleds)
			free(device->leds[--device->nleds]);
		free(device->leds);
		while (device->npower_supplies)
			free(device->power_supplies[--device->npower_supplies]);
		free(device->power_supplies);
	}
}