summaryrefslogtreecommitdiff
path: root/libbacklight.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbacklight.c')
-rw-r--r--libbacklight.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libbacklight.c b/libbacklight.c
index e2aaae0..c2cc900 100644
--- a/libbacklight.c
+++ b/libbacklight.c
@@ -105,6 +105,17 @@ out:
return ret;
}
+void backlight_destroy(struct backlight *backlight)
+{
+ if (!backlight)
+ return;
+
+ if (backlight->path)
+ free(backlight->path);
+
+ free(backlight);
+}
+
struct backlight *backlight_init(struct pci_device *dev, int card,
int connector_type, int connector_type_id)
{
@@ -172,6 +183,8 @@ struct backlight *backlight_init(struct pci_device *dev, int card,
if (ret < 0)
goto out;
+ buffer[ret] = '\0';
+
parent = basename(buffer);
if (entry_type == BACKLIGHT_RAW) {