dcavalca / rpms / linuxptp

Forked from rpms/linuxptp 2 years ago
Clone

Blame SOURCES/linuxptp-msgput.patch

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