changeset 133:ad398971b27a

common: don't leak vector clocks via XDR When an xdr_*() function is called with the XDR_FREE op, we should free the clock instead of passing the op onto the constituent integers. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sun, 18 Oct 2015 10:26:07 -0400
parents ccf91f4e7c8f
children b1c7d4b13ce2
files src/common/vclock.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/common/vclock.c	Sun Oct 18 09:43:05 2015 -0400
+++ b/src/common/vclock.c	Sun Oct 18 10:26:07 2015 -0400
@@ -416,6 +416,11 @@
 {
 	int i;
 
+	if (xdrs->x_op == XDR_FREE) {
+		nvclock_free(clock);
+		return TRUE;
+	}
+
 	for (i = 0; i < NVCLOCK_NUM_NODES; i++) {
 		if (!xdr_uint64_t(xdrs, &clock->ent[i].node))
 			return FALSE;