Check calloc return value (#9527)

This commit is contained in:
Hugo van Kemenade 2026-04-01 15:11:00 +03:00 committed by GitHub
commit cdaa29eb52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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);