Fix refcount leak in error cases. Bug found by coverity.
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index ef85b87..96264e7 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -1452,11 +1452,14 @@
size += 1; /* terminating NUL */
size *= sizeof(wchar_t);
buffer = (wchar_t *)PyMem_Malloc(size);
- if (!buffer)
+ if (!buffer) {
+ Py_DECREF(value);
return PyErr_NoMemory();
+ }
memset(buffer, 0, size);
keep = PyCObject_FromVoidPtr(buffer, PyMem_Free);
if (!keep) {
+ Py_DECREF(value);
PyMem_Free(buffer);
return NULL;
}