Skip to content

Commit 528dec6

Browse files
authored
Fix memory leak on error path in cxoObjectType_initialize (#422)
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
1 parent ca363be commit 528dec6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/cxoObjectType.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ static int cxoObjectType_initialize(cxoObjectType *objType,
146146
}
147147
PyList_SET_ITEM(objType->attributes, i, (PyObject*) attr);
148148
if (PyDict_SetItem(objType->attributesByName, attr->name,
149-
(PyObject*) attr) < 0)
149+
(PyObject*) attr) < 0) {
150+
PyMem_Free(attributes);
150151
return -1;
152+
}
151153
}
152154
PyMem_Free(attributes);
153155
return 0;

0 commit comments

Comments
 (0)