Annotate dbus_malloc*() functions with __attribute__ malloc and __attribute__ alloc_size
authorCristian Rodríguez <cristian.rodriguez@opensuse.org>
Wed, 29 Dec 2010 00:10:31 +0000 (21:10 -0300)
committerSimon McVittie <smcv@debian.org>
Wed, 5 Jan 2011 13:13:48 +0000 (13:13 +0000)
commite2be7b92a6d46f02d8d682dd9e51bb494f41e92c
treef1509eafcb077e442b4d40a12af8a0c151e8b958
parent56d8d4f58ee60cd4f860a99a2dd47b3f636321b8
Annotate dbus_malloc*() functions with __attribute__ malloc and __attribute__ alloc_size

This improves optimization as well catches buffer overflows at compile time.

code like:

foo = dbus_malloc(2);
strcpy(foo, "epicfail");

will emit:

"warning ... will always overflow the destination buffer..."

Signed-off-by: Cristian Rodríguez <cristian.rodriguez@opensuse.org>
Reviewed-by: Thiago Macieira <thiago@kde.org>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=32710
dbus/dbus-macros.h
dbus/dbus-memory.h