Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(14)

Side by Side Diff: Modules/_multiprocessing/semaphore.c

Issue 27591: multiprocessing: Possible uninitialized pointer use in Windows builds
Patch Set: Created 3 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * A type which wraps a semaphore 2 * A type which wraps a semaphore
3 * 3 *
4 * semaphore.c 4 * semaphore.c
5 * 5 *
6 * Copyright (c) 2006-2008, R Oudkerk 6 * Copyright (c) 2006-2008, R Oudkerk
7 * Licensed to PSF under a Contributor Agreement. 7 * Licensed to PSF under a Contributor Agreement.
8 */ 8 */
9 9
10 #include "multiprocessing.h" 10 #include "multiprocessing.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 } 59 }
60 60
61 static PyObject * 61 static PyObject *
62 semlock_acquire(SemLockObject *self, PyObject *args, PyObject *kwds) 62 semlock_acquire(SemLockObject *self, PyObject *args, PyObject *kwds)
63 { 63 {
64 int blocking = 1; 64 int blocking = 1;
65 double timeout; 65 double timeout;
66 PyObject *timeout_obj = Py_None; 66 PyObject *timeout_obj = Py_None;
67 DWORD res, full_msecs, nhandles; 67 DWORD res, full_msecs, nhandles;
68 HANDLE handles[2], sigint_event; 68 HANDLE handles[2], sigint_event = NULL;
69 69
70 static char *kwlist[] = {"block", "timeout", NULL}; 70 static char *kwlist[] = {"block", "timeout", NULL};
71 71
72 if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iO", kwlist, 72 if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iO", kwlist,
73 &blocking, &timeout_obj)) 73 &blocking, &timeout_obj))
74 return NULL; 74 return NULL;
75 75
76 /* calculate timeout */ 76 /* calculate timeout */
77 if (!blocking) { 77 if (!blocking) {
78 full_msecs = 0; 78 full_msecs = 0;
(...skipping 27 matching lines...) Expand all
106 Py_RETURN_TRUE; 106 Py_RETURN_TRUE;
107 } 107 }
108 108
109 /* prepare list of handles */ 109 /* prepare list of handles */
110 nhandles = 0; 110 nhandles = 0;
111 handles[nhandles++] = self->handle; 111 handles[nhandles++] = self->handle;
112 if (_PyOS_IsMainThread()) { 112 if (_PyOS_IsMainThread()) {
113 sigint_event = _PyOS_SigintEvent(); 113 sigint_event = _PyOS_SigintEvent();
114 assert(sigint_event != NULL); 114 assert(sigint_event != NULL);
115 handles[nhandles++] = sigint_event; 115 handles[nhandles++] = sigint_event;
116 } 116 }
haypo 2016/07/22 19:37:13 I suggest to assign sigint_event to NULL here.
117 117
118 /* do the wait */ 118 /* do the wait */
119 Py_BEGIN_ALLOW_THREADS 119 Py_BEGIN_ALLOW_THREADS
120 if (sigint_event != NULL) 120 if (sigint_event != NULL)
121 ResetEvent(sigint_event); 121 ResetEvent(sigint_event);
122 res = WaitForMultipleObjectsEx(nhandles, handles, FALSE, full_msecs, FALSE); 122 res = WaitForMultipleObjectsEx(nhandles, handles, FALSE, full_msecs, FALSE);
123 Py_END_ALLOW_THREADS 123 Py_END_ALLOW_THREADS
124 124
125 /* handle result */ 125 /* handle result */
126 switch (res) { 126 switch (res) {
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 if (!PyArg_ParseTuple(args, "s", &name)) 664 if (!PyArg_ParseTuple(args, "s", &name))
665 return NULL; 665 return NULL;
666 666
667 if (SEM_UNLINK(name) < 0) { 667 if (SEM_UNLINK(name) < 0) {
668 _PyMp_SetError(NULL, MP_STANDARD_ERROR); 668 _PyMp_SetError(NULL, MP_STANDARD_ERROR);
669 return NULL; 669 return NULL;
670 } 670 }
671 671
672 Py_RETURN_NONE; 672 Py_RETURN_NONE;
673 } 673 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+