File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2408,7 +2408,7 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
24082408 data = PyBytes_FromStringAndSize (NULL , newsize);
24092409 if (data == NULL )
24102410 {
2411- throw Py::MemoryError (" RendererAgg::tostring_minimized could not allocate memory" );
2411+ throw Py::MemoryError (" RendererAgg::tostring_rgba_minimized could not allocate memory" );
24122412 }
24132413 dst = (unsigned int *)PyBytes_AsString (data);
24142414
@@ -2420,6 +2420,12 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
24202420 *dst = src[y * width + x];
24212421 }
24222422 }
2423+ } else {
2424+ data = PyBytes_FromStringAndSize (NULL , 0 );
2425+ if (data == NULL )
2426+ {
2427+ throw Py::MemoryError (" RendererAgg::tostring_rgba_minimized could not allocate memory" );
2428+ }
24232429 }
24242430
24252431 Py::Tuple bounds (4 );
@@ -2429,8 +2435,7 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
24292435 bounds[3 ] = Py::Int (newheight);
24302436
24312437 Py::Tuple result (2 );
2432- result[0 ] = Py::Object (data, false );
2433- Py_DECREF (data);
2438+ result[0 ] = Py::Object (data, true );
24342439 result[1 ] = bounds;
24352440
24362441 return result;
You can’t perform that action at this time.
0 commit comments