[PATCH 8/8] backlight: Jump to cleanup code if synthesizing backlight string fails
Rob Bradford
robert.bradford at intel.com
Tue Oct 9 10:44:36 PDT 2012
From: Rob Bradford <rob at linux.intel.com>
This applies the same pattern as used in other error cases in this block - and
cleans up the file desciptors and allocated memory too.
Signed-off-by: Rob Bradford <rob at linux.intel.com>
---
src/libbacklight.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/libbacklight.c b/src/libbacklight.c
index c432c6e..df811b4 100644
--- a/src/libbacklight.c
+++ b/src/libbacklight.c
@@ -111,8 +111,10 @@ long backlight_set_brightness(struct backlight *backlight, long brightness)
goto out;
}
- if (asprintf(&buffer, "%ld", brightness) < 0)
- return -ENOMEM;
+ if (asprintf(&buffer, "%ld", brightness) < 0) {
+ ret = -1;
+ goto out;
+ }
ret = write(fd, buffer, strlen(buffer));
if (ret < 0) {
--
1.7.11.2
More information about the wayland-devel
mailing list