File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -2408,7 +2408,7 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
2408
2408
data = PyBytes_FromStringAndSize (NULL , newsize);
2409
2409
if (data == NULL )
2410
2410
{
2411
- throw Py::MemoryError (" RendererAgg::tostring_minimized could not allocate memory" );
2411
+ throw Py::MemoryError (" RendererAgg::tostring_rgba_minimized could not allocate memory" );
2412
2412
}
2413
2413
dst = (unsigned int *)PyBytes_AsString (data);
2414
2414
@@ -2420,6 +2420,12 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
2420
2420
*dst = src[y * width + x];
2421
2421
}
2422
2422
}
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
+ }
2423
2429
}
2424
2430
2425
2431
Py::Tuple bounds (4 );
@@ -2429,8 +2435,7 @@ RendererAgg::tostring_rgba_minimized(const Py::Tuple& args)
2429
2435
bounds[3 ] = Py::Int (newheight);
2430
2436
2431
2437
Py::Tuple result (2 );
2432
- result[0 ] = Py::Object (data, false );
2433
- Py_DECREF (data);
2438
+ result[0 ] = Py::Object (data, true );
2434
2439
result[1 ] = bounds;
2435
2440
2436
2441
return result;
You can’t perform that action at this time.
0 commit comments