|
@@ -5,12 +5,14 @@
|
5
|
5
|
|
6
|
6
|
#include <stdio.h> //snprintf
|
7
|
7
|
#include <stdlib.h> // malloc, free
|
|
8
|
+#include <string.h> // memset
|
8
|
9
|
#include <dirent.h> // opendir, readdir
|
9
|
10
|
|
10
|
11
|
static bool _impl_sysfs_init_leds(light_device_enumerator_t *enumerator)
|
11
|
12
|
{
|
12
|
13
|
// Create a new backlight device
|
13
|
14
|
light_device_t *leds_device = malloc(sizeof(light_device_t));
|
|
15
|
+ memset(leds_device, 0, sizeof(light_device_t));
|
14
|
16
|
snprintf(leds_device->name, sizeof(leds_device->name), "%s", "leds");
|
15
|
17
|
|
16
|
18
|
// Add it to the enumerator
|
|
@@ -63,6 +65,7 @@ static bool _impl_sysfs_init_backlight(light_device_enumerator_t *enumerator)
|
63
|
65
|
{
|
64
|
66
|
// Create a new backlight device
|
65
|
67
|
light_device_t *backlight_device = malloc(sizeof(light_device_t));
|
|
68
|
+ memset(backlight_device, 0, sizeof(light_device_t));
|
66
|
69
|
snprintf(backlight_device->name, sizeof(backlight_device->name), "%s", "backlight");
|
67
|
70
|
|
68
|
71
|
// Add it to the enumerator
|