Skip to content

Commit cdaa29e

Browse files
authored
Check calloc return value (#9527)
2 parents ecf011e + 585b2f5 commit cdaa29e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/_imaging.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ PyObject *
267267
ExportArrowSchemaPyCapsule(ImagingObject *self) {
268268
struct ArrowSchema *schema =
269269
(struct ArrowSchema *)calloc(1, sizeof(struct ArrowSchema));
270+
if (!schema) {
271+
return ArrowError(IMAGING_CODEC_MEMORY);
272+
}
270273
int err = export_imaging_schema(self->image, schema);
271274
if (err == 0) {
272275
return PyCapsule_New(schema, "arrow_schema", ReleaseArrowSchemaPyCapsule);

0 commit comments

Comments
 (0)