Skip to content

fix leak of connection->converter. #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions _mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,10 @@ static int _mysql_ResultObject_traverse(
return 0;
}

static int _mysql_ResultObject_clear(
_mysql_ResultObject *self)
static int _mysql_ResultObject_clear(_mysql_ResultObject *self)
{
Py_XDECREF(self->converter);
self->converter = NULL;
Py_XDECREF(self->conn);
self->conn = NULL;
Py_CLEAR(self->converter);
Py_CLEAR(self->conn);
return 0;
}

Expand Down Expand Up @@ -796,8 +793,7 @@ _mysql_ConnectionObject_close(
return NULL;
}
_mysql_ConnectionObject_clear(self);
Py_INCREF(Py_None);
return Py_None;
Py_RETURN_NONE;
}

static char _mysql_ConnectionObject_affected_rows__doc__ [] =
Expand Down Expand Up @@ -2159,6 +2155,7 @@ _mysql_ConnectionObject_dealloc(
mysql_close(&(self->connection));
self->open = 0;
}
Py_CLEAR(self->converter);
MyFree(self);
}

Expand Down