8000 Check the return values of mpl_PyFile_DupClose · jdgd1/matplotlib@0c0ff8b · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c0ff8b

Browse files
committed
Check the return values of mpl_PyFile_DupClose
1 parent db98d01 commit 0c0ff8b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/ft2font.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ FT2Image::py_write_bitmap(const Py::Tuple & args)
193193

194194
write_bitmap(fh);
195195

196-
mpl_PyFile_DupClose(py_file, fh, offset);
196+
if (mpl_PyFile_DupClose(py_f 9E68 ile, fh, offset))
197+
{
198+
throw Py::Exception();
199+
}
197200
mpl_PyFile_CloseFile(py_file);
198201
Py_DECREF(py_file);
199202

@@ -2143,7 +2146,10 @@ static void close_file_callback(FT_Stream stream)
21432146
{
21442147
py_file_def *def = (py_file_def *)stream->descriptor.pointer;
21452148

2146-
mpl_PyFile_DupClose(def->py_file, def->fp, def->offset);
2149+
if (mpl_PyFile_DupClose(def->py_file, def->fp, def->offset))
2150+
{
2151+
throw Py::Exception();
2152+
}
21472153

21482154
if (def->close_file) {
21492155
mpl_PyFile_CloseFile(def->py_file);

0 commit comments

Comments
 (0)
0