Check calloc return value

This commit is contained in:
Andrew Murray 2026-03-29 18:11:36 +11:00
parent ecf011ea15
commit 585b2f5a78

View File

@ -267,6 +267,9 @@ PyObject *
ExportArrowSchemaPyCapsule(ImagingObject *self) {
struct ArrowSchema *schema =
(struct ArrowSchema *)calloc(1, sizeof(struct ArrowSchema));
if (!schema) {
return ArrowError(IMAGING_CODEC_MEMORY);
}
int err = export_imaging_schema(self->image, schema);
if (err == 0) {
return PyCapsule_New(schema, "arrow_schema", ReleaseArrowSchemaPyCapsule);