From dbfd87c27e0f73b95b2ae16d0b76e059484d5375 Mon Sep 17 00:00:00 2001 From: Corentin Lecouvey Date: Fri, 17 Oct 2014 14:17:41 +0200 Subject: [PATCH] allocate BUFSIZ size instead of payload_size when creating packet Using notification API, it appears that allocating payload_size when creating a packet could makes notification-service crash sometimes when removing a notification. Checking some packet sizes shows that allocates BUFSIZ is enough and fix the problem. Change-Id: I4b1d134fe43b235b586ba184053134299cc56cb0 Signed-off-by: Corentin Lecouvey --- src/packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packet.c b/src/packet.c index 6057b56..3c3fb79 100644 --- a/src/packet.c +++ b/src/packet.c @@ -378,7 +378,7 @@ EAPI struct packet *packet_create(const char *cmd, const char *fmt, ...) payload_size = sizeof(*packet->data) + BUFSIZ; packet->refcnt = 0; - packet->data = calloc(1, payload_size); + packet->data = calloc(1, BUFSIZ); if (!packet->data) { ErrPrint("Heap: %s\n", strerror(errno)); packet->state = INVALID; -- 2.7.4