backlight: fix backlight_path memory leak
authorU. Artie Eoff <ullysses.a.eoff@intel.com>
Wed, 15 Jan 2014 16:12:19 +0000 (08:12 -0800)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 20 Jan 2014 05:58:53 +0000 (21:58 -0800)
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
src/libbacklight.c

index a9d7ef1..54f3318 100644 (file)
@@ -210,8 +210,10 @@ struct backlight *backlight_init(struct udev_device *drm_device,
                             entry->d_name) < 0)
                        goto err;
 
-               if (asprintf(&path, "%s/%s", backlight_path, "type") < 0)
+               if (asprintf(&path, "%s/%s", backlight_path, "type") < 0) {
+                       free(backlight_path);
                        goto err;
+               }
 
                fd = open(path, O_RDONLY);