[pypy-commit] cffi default: #442: memory leak in getwinerror() in py3
arigo
pypy.commits at gmail.com
Thu Feb 6 05:35:47 EST 2020
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r3333:4c9bc72ff7a2
Date: 2020-02-06 11:35 +0100
http://bitbucket.org/cffi/cffi/changeset/4c9bc72ff7a2/
Log: #442: memory leak in getwinerror() in py3
diff --git a/c/misc_win32.h b/c/misc_win32.h
--- a/c/misc_win32.h
+++ b/c/misc_win32.h
@@ -124,8 +124,10 @@
s_buf[--len] = L'\0';
message = PyUnicode_FromWideChar(s_buf, len);
}
- if (message != NULL)
+ if (message != NULL) {
v = Py_BuildValue("(iO)", err, message);
+ Py_DECREF(message);
+ }
else
v = NULL;
LocalFree(s_buf);
@@ -168,7 +170,6 @@
/* Only seen this in out of mem situations */
sprintf(s_small_buf, "Windows Error 0x%X", err);
s = s_small_buf;
- s_buf = NULL;
} else {
s = s_buf;
/* remove trailing cr/lf and dots */
More information about the pypy-commit
mailing list