git » pytipc » commit 5592de7

Free a buffer on an error path

author Alberto Bertogli
2008-02-19 00:17:28 UTC
committer Alberto Bertogli
2008-02-19 00:17:28 UTC
parent aa13a02150107798349d55fe113e23048eb8814c

Free a buffer on an error path

tipc_ll.c +3 -1

diff --git a/tipc_ll.c b/tipc_ll.c
index 0ef1751..fb623fe 100644
--- a/tipc_ll.c
+++ b/tipc_ll.c
@@ -223,8 +223,10 @@ static PyObject *tipc_recvfrom(PyObject *self, PyObject *args)
 			(struct sockaddr *) &sa, &salen);
 	Py_END_ALLOW_THREADS
 
-	if (rv < 0)
+	if (rv < 0) {
+		free(buf);
 		return PyErr_SetFromErrno(PyExc_IOError);
+	}
 
 	str = PyString_FromStringAndSize(buf, rv);
 	free(buf);