Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f41e651

Browse filesBrowse files
authored
fix leak of connection->converter. (PyMySQL#182)
1 parent 354dcb5 commit f41e651
Copy full SHA for f41e651

File tree

Expand file treeCollapse file tree

1 file changed

+5
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-8
lines changed

‎_mysql.c

Copy file name to clipboardExpand all lines: _mysql.c
+5-8Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,10 @@ static int _mysql_ResultObject_traverse(
495495
return 0;
496496
}
497497

498-
static int _mysql_ResultObject_clear(
499-
_mysql_ResultObject *self)
498+
static int _mysql_ResultObject_clear(_mysql_ResultObject *self)
500499
{
501-
Py_XDECREF(self->converter);
502-
self->converter = NULL;
503-
Py_XDECREF(self->conn);
504-
self->conn = NULL;
500+
Py_CLEAR(self->converter);
501+
Py_CLEAR(self->conn);
505502
return 0;
506503
}
507504

@@ -796,8 +793,7 @@ _mysql_ConnectionObject_close(
796793
return NULL;
797794
}
798795
_mysql_ConnectionObject_clear(self);
799-
Py_INCREF(Py_None);
800-
return Py_None;
796+
Py_RETURN_NONE;
801797
}
802798

803799
static char _mysql_ConnectionObject_affected_rows__doc__ [] =
@@ -2162,6 +2158,7 @@ _mysql_ConnectionObject_dealloc(
21622158
mysql_close(&(self->connection));
21632159
self->open = 0;
21642160
}
2161+
Py_CLEAR(self->converter);
21652162
MyFree(self);
21662163
}
21672164

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.