dcavalca / rpms / linuxptp

Forked from rpms/linuxptp 2 years ago
Clone

Blame SOURCES/linuxptp-msgput.patch

4b595f
commit 86723cfc6a7ac1d9b1bff5e90b7f4696d6460a0e
4b595f
Author: Miroslav Lichvar <mlichvar@redhat.com>
4b595f
Date:   Thu Mar 21 17:12:03 2019 +0100
4b595f
4b595f
    pmc: Don't leak memory when msg_tlv_append() fails.
4b595f
    
4b595f
    Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
4b595f
4b595f
diff --git a/pmc_common.c b/pmc_common.c
4b595f
index 4a160f6..4d48e3a 100644
4b595f
--- a/pmc_common.c
4b595f
+++ b/pmc_common.c
4b595f
@@ -546,6 +546,7 @@ int pmc_send_set_action(struct pmc *pmc, int id, void *data, int datasize)
4b595f
 	}
4b595f
 	extra = msg_tlv_append(msg, sizeof(*mgt) + datasize);
4b595f
 	if (!extra) {
4b595f
+		msg_put(msg);
4b595f
 		return -ENOMEM;
4b595f
 	}
4b595f
 	mgt = (struct management_tlv *) extra->tlv;