From 430b8c1b05e98d6f5e10ab17afafe2f68ed56278 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Tue, 27 Jan 2004 18:38:22 +0000 Subject: [PATCH] Fixed memory leak in NgSendAsciiMsg(). --- lib/libnetgraph/msg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/libnetgraph/msg.c b/lib/libnetgraph/msg.c index 927a31ad856b..f89c27f284ee 100644 --- a/lib/libnetgraph/msg.c +++ b/lib/libnetgraph/msg.c @@ -132,8 +132,11 @@ NgSendAsciiMsg(int cs, const char *path, const char *fmt, ...) /* Send node a request to convert ASCII to binary */ if (NgSendMsg(cs, path, NGM_GENERIC_COOKIE, NGM_ASCII2BINARY, - (u_char *)ascii, sizeof(*ascii) + ascii->header.arglen) < 0) + (u_char *)ascii, sizeof(*ascii) + ascii->header.arglen) < 0) { + free(ascii); return (-1); + } + free(ascii); /* Get reply */ if (NgRecvMsg(cs, reply, sizeof(replybuf), NULL) < 0)