Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8e13db1

Browse files
committed
Fix cleanup of PNG structures on error.
If `info_ptr` isn't created, we should still destroy `png_ptr`.
1 parentae00468 commit8e13db1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎src/_png.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,12 @@ static PyObject *Py_write_png(PyObject *self, PyObject *args, PyObject *kwds)
346346
png_write_end(png_ptr, info_ptr);
347347

348348
exit:
349-
if (png_ptr && info_ptr) {
350-
png_destroy_write_struct(&png_ptr, &info_ptr);
349+
if (png_ptr) {
350+
if (info_ptr) {
351+
png_destroy_write_struct(&png_ptr, &info_ptr);
352+
}else {
353+
png_destroy_write_struct(&png_ptr,NULL);
354+
}
351355
}
352356
if (PyErr_Occurred()) {
353357
Py_XDECREF(buff.str);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp