Skip to content

Commit 8aa80d1

Browse files
committed
Fix memory leak by releasing buffer
1 parent 2d340fe commit 8aa80d1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/isal/isal_zlib.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ PyDoc_STRVAR(zlib_compress__doc__,
241241
static PyObject *
242242
isal_zlib_compress(PyObject *module, PyObject *args, PyObject *kwargs)
243243
{
244-
PyObject *return_value = NULL;
245244
char *keywords[] = {"", "level", "wbits", NULL};
246245
char *format ="y*|ii:isal_zlib.compress";
247246
Py_buffer data = {NULL, NULL};
@@ -260,8 +259,9 @@ isal_zlib_compress(PyObject *module, PyObject *args, PyObject *kwargs)
260259
PyBuffer_Release(&data);
261260
return NULL;
262261
}
263-
return_value = igzip_lib_compress_impl(&data, level,
264-
flag, MEM_LEVEL_DEFAULT, hist_bits);
262+
PyObject *return_value = igzip_lib_compress_impl(
263+
&data, level, flag, MEM_LEVEL_DEFAULT, hist_bits);
264+
PyBuffer_Release(&data);
265265
return return_value;
266266
}
267267

0 commit comments

Comments
 (0)