Skip to content

Commit

Permalink
Fix issue #116 - memory leaks in exprnode.c
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdrake committed Mar 17, 2015
1 parent aac235d commit cb56a58
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pyeda/boolalg/exprnodemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,13 @@ ExprNode_restrict(ExprNode *self, PyObject *args)
}

if ((ex = BoolExpr_Restrict(self->ex, var2ex)) == NULL) {
BoolExprDict_Del(var2ex);
PyErr_SetString(Error, "BoolExpr_Restrict failed");
return NULL;
}

BoolExprDict_Del(var2ex);

if (ex == self->ex) {
BoolExpr_DecRef(ex);
Py_INCREF((PyObject *) self);
Expand Down Expand Up @@ -568,10 +571,13 @@ ExprNode_compose(ExprNode *self, PyObject *args)
}

if ((ex = BoolExpr_Compose(self->ex, var2ex)) == NULL) {
BoolExprDict_Del(var2ex);
PyErr_SetString(Error, "BoolExpr_Compose failed");
return NULL;
}

BoolExprDict_Del(var2ex);

if (ex == self->ex) {
BoolExpr_DecRef(ex);
Py_INCREF((PyObject *) self);
Expand Down

0 comments on commit cb56a58

Please sign in to comment.