Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/_backend_agg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2408,7 +2408,7 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
data = PyBytes_FromStringAndSize(NULL, newsize);
if (data == NULL)
{
throw Py::MemoryError("RendererAgg::tostring_minimized could not allocate memory");
throw Py::MemoryError("RendererAgg::tostring_rgba_minimized could not allocate memory");
}
dst = (unsigned int *)PyBytes_AsString(data);

Expand All @@ -2420,6 +2420,12 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
*dst = src[y * width + x];
}
}
} else {
data = PyBytes_FromStringAndSize(NULL, 0);
if (data == NULL)
{
throw Py::MemoryError("RendererAgg::tostring_rgba_minimized could not allocate memory");
}
}

Py::Tuple bounds(4);
Expand All @@ -2429,8 +2435,7 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
bounds[3] = Py::Int(newheight);

Py::Tuple result(2);
result[0] = Py::Object(data, false);
Py_DECREF(data);
result[0] = Py::Object(data, true);
result[1] = bounds;

return result;
Expand Down