Skip to content

Fix #3304. #3324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 31, 2014
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