Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
731a9f6c
Commit
731a9f6c
authored
May 16, 2017
by
Jason Rhinelander
Browse files
Fix Py_buffer leak on GetBuffer failure
Fixes #852.
parent
4567f1f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
include/pybind11/pytypes.h
include/pybind11/pytypes.h
+3
-1
No files found.
include/pybind11/pytypes.h
View file @
731a9f6c
...
...
@@ -1155,8 +1155,10 @@ public:
int
flags
=
PyBUF_STRIDES
|
PyBUF_FORMAT
;
if
(
writable
)
flags
|=
PyBUF_WRITABLE
;
Py_buffer
*
view
=
new
Py_buffer
();
if
(
PyObject_GetBuffer
(
m_ptr
,
view
,
flags
)
!=
0
)
if
(
PyObject_GetBuffer
(
m_ptr
,
view
,
flags
)
!=
0
)
{
delete
view
;
throw
error_already_set
();
}
return
buffer_info
(
view
);
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment