core: use the 'malloc' attribute
authorBartosz Golaszewski <bartekgola@gmail.com>
Wed, 1 Mar 2017 10:19:12 +0000 (11:19 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Wed, 1 Mar 2017 10:19:12 +0000 (11:19 +0100)
Use the 'malloc' gcc attribute in the zalloc() definition.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
src/lib/core.c

index c5e815293231da1f5f166951b51dc1fb407ca517..2d313bc167480956f3e962a4a11e0ce299904586 100644 (file)
@@ -23,6 +23,8 @@
 #include <poll.h>
 #include <linux/gpio.h>
 
+#define MALLOC __attribute__((malloc))
+
 struct gpiod_chip {
        int fd;
        struct gpiochip_info cinfo;
@@ -95,7 +97,7 @@ static void last_error_from_errno(void)
        last_error = errno;
 }
 
-static void * zalloc(size_t size)
+static MALLOC void * zalloc(size_t size)
 {
        void *ptr;