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

Delta Between Two Patch Sets: Modules/_multiprocessing/semaphore.c

Issue 27591: multiprocessing: Possible uninitialized pointer use in Windows builds
Left Patch Set: Created 3 years, 5 months ago
Right Patch Set: Created 3 years, 5 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 = NULL; 68 HANDLE handles[2], sigint_event;
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 } else {
haypo 2016/07/23 02:06:33 PEP 7: } else {
117 sigint_event = NULL;
116 } 118 }
haypo 2016/07/22 19:37:13 I suggest to assign sigint_event to NULL here.
117 119
118 /* do the wait */ 120 /* do the wait */
119 Py_BEGIN_ALLOW_THREADS 121 Py_BEGIN_ALLOW_THREADS
120 if (sigint_event != NULL) 122 if (sigint_event != NULL)
121 ResetEvent(sigint_event); 123 ResetEvent(sigint_event);
122 res = WaitForMultipleObjectsEx(nhandles, handles, FALSE, full_msecs, FALSE); 124 res = WaitForMultipleObjectsEx(nhandles, handles, FALSE, full_msecs, FALSE);
123 Py_END_ALLOW_THREADS 125 Py_END_ALLOW_THREADS
124 126
125 /* handle result */ 127 /* handle result */
126 switch (res) { 128 switch (res) {
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 if (!PyArg_ParseTuple(args, "s", &name)) 666 if (!PyArg_ParseTuple(args, "s", &name))
665 return NULL; 667 return NULL;
666 668
667 if (SEM_UNLINK(name) < 0) { 669 if (SEM_UNLINK(name) < 0) {
668 _PyMp_SetError(NULL, MP_STANDARD_ERROR); 670 _PyMp_SetError(NULL, MP_STANDARD_ERROR);
669 return NULL; 671 return NULL;
670 } 672 }
671 673
672 Py_RETURN_NONE; 674 Py_RETURN_NONE;
673 } 675 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

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