From 251fcad42e6435006836b3fa01c12011cc7bfb27 Mon Sep 17 00:00:00 2001
From: Alberto Bertogli <albertito@blitiri.com.ar>
Date: Sun, 27 Feb 2011 11:39:53 +0000
Subject: [PATCH 18/24] bindings/python: Fix broken realloc() new size

This patch fixes the new size parameter given to realloc(), which was (very)
wrong.

Surprisingly, this simple mistake wasn't caught by the tests OR valgrind under
Linux, but on FreeBSD made one of the tests crash (behaviour n23), and it did
appear under valgrind on that platform.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
---
 bindings/python/libjio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/bindings/python/libjio.c b/bindings/python/libjio.c
index c37ec86..f033dfb 100644
--- a/bindings/python/libjio.c
+++ b/bindings/python/libjio.c
@@ -771,7 +771,7 @@ static PyObject *jt_add_r(jtrans_object *tp, PyObject *args)
 		return PyErr_SetFromErrno(PyExc_IOError);
 	}
 
-	new_views = realloc(tp->views, sizeof(Py_buffer *) * tp->nviews + 1);
+	new_views = realloc(tp->views, sizeof(Py_buffer *) * (tp->nviews + 1));
 	if (new_views == NULL) {
 		PyBuffer_Release(view);
 		free(view);
-- 
1.6.2.2.646.gb214

