Skip to content

Commit ea0bc2b

Browse files
benjefferymergify-bot
authored andcommitted
Fix memory leak in population table get row
1 parent c7c89c1 commit ea0bc2b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

python/_tskitmodule.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,12 @@ make_population(tsk_population_t *population)
326326
PyObject *ret = NULL;
327327
PyObject *metadata = make_metadata(population->metadata,
328328
(Py_ssize_t) population->metadata_length);
329-
329+
if (metadata == NULL) {
330+
goto out;
331+
}
330332
ret = Py_BuildValue("(O)", metadata);
333+
out:
334+
Py_XDECREF(metadata);
331335
return ret;
332336
}
333337

0 commit comments

Comments
 (0)