summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbacklight.c13
-rw-r--r--libbacklight.h1
2 files changed, 14 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) {
diff --git a/libbacklight.h b/libbacklight.h
index 20981bd..baf7e8a 100644
--- a/libbacklight.h
+++ b/libbacklight.h
@@ -13,6 +13,7 @@ struct backlight {
enum backlight_type type;
};
+void backlight_destroy(struct backlight *backlight);
struct backlight *backlight_init(struct pci_device *dev, int card,
int connector_type, int connector_type_id);
long backlight_get_brightness(struct backlight *backlight);