File: | src/extensions/shmmodule.c |
Function: | PyShm_semaphore |
Error: | passing uninitialized data (arg) as argument 4 to function at src/extensions/shmmodule.c:1246 |
1211 static PyObject *
1212 PyShm_semaphore(
1213 PyObject *self,
1214 PyObject *args)
1215 {
1216 int semid;
1217 PyShmSemObj *o;
1218 PyObject *keyo;
1219 semctl_arg arg;
1220
1221 if (!PyArg_ParseTuple(args, "i", &semid))
when PyArg_ParseTuple() succeeds
taking False path
1222 return NULL;
1223 keyo = PyInt_FromLong(semid);
when PyInt_FromLong() succeeds
1224 /* get the object from the dictionary */
1225 if (PyMapping_HasKey(sem_dict, keyo)) {
when considering range: -0x80000000 <= value <= -1
taking True path
1226 o = (PyShmSemObj *)PyDict_GetItem(sem_dict, keyo);
when treating unknown struct PyObject * from src/extensions/shmmodule.c:196 as non-NULL
when PyDict_GetItem() succeeds
1227 Py_INCREF(o);
1228 }
1229 else {
1230 /* not found, create it */
1231 if ((o = PyObject_NEW(PyShmSemObj, &PyShmSemaphore_Type)) == NULL)
1232 return NULL;
1233 o->semid = semid;
1234 o->opflag = 0;
1235 /* sem_dict[semid] = o */
1236 if (PyDict_SetItem(sem_dict, keyo, (PyObject *)o) == -1) {
1237 Py_DECREF(o);
1238 PyErr_SetString(PyShm_Error,
1239 "can't initialize semaphore object");
1240 return NULL;
1241 }
1242 Py_DECREF(o); /* the owned reference in sem_dict doesn't count! */
1243 }
1244 /* set up the status data */
1245 arg.buf = &(o->ds);
1246 if (semctl(o->semid, 0, IPC_STAT, arg) == -1) {
passing uninitialized data (arg) as argument 4 to function at src/extensions/shmmodule.c:1246
found 2 similar trace(s) to this
1247 Py_DECREF(o);
1248 PyErr_SetString(PyShm_Error,
1249 "can't access semaphore");
1250 return NULL;
1251 }
1252 return (PyObject *)o;
1253 }
File: | src/extensions/shmmodule.c |
Function: | PyShm_semaphore |
Error: | dereferencing NULL (MEM[(struct PyObject *)o].ob_refcnt) at src/extensions/shmmodule.c:1227 |
1211 static PyObject *
1212 PyShm_semaphore(
1213 PyObject *self,
1214 PyObject *args)
1215 {
1216 int semid;
1217 PyShmSemObj *o;
1218 PyObject *keyo;
1219 semctl_arg arg;
1220
1221 if (!PyArg_ParseTuple(args, "i", &semid))
when PyArg_ParseTuple() succeeds
taking False path
1222 return NULL;
1223 keyo = PyInt_FromLong(semid);
when PyInt_FromLong() succeeds
1224 /* get the object from the dictionary */
1225 if (PyMapping_HasKey(sem_dict, keyo)) {
when considering range: -0x80000000 <= value <= -1
taking True path
1226 o = (PyShmSemObj *)PyDict_GetItem(sem_dict, keyo);
when treating unknown struct PyObject * from src/extensions/shmmodule.c:196 as non-NULL
when PyDict_GetItem does not find item
1227 Py_INCREF(o);
dereferencing NULL (MEM[(struct PyObject *)o].ob_refcnt) at src/extensions/shmmodule.c:1227
found 1 similar trace(s) to this
1228 }
1229 else {
1230 /* not found, create it */
1231 if ((o = PyObject_NEW(PyShmSemObj, &PyShmSemaphore_Type)) == NULL)
1232 return NULL;
1233 o->semid = semid;
1234 o->opflag = 0;
1235 /* sem_dict[semid] = o */
1236 if (PyDict_SetItem(sem_dict, keyo, (PyObject *)o) == -1) {
1237 Py_DECREF(o);
1238 PyErr_SetString(PyShm_Error,
1239 "can't initialize semaphore object");
1240 return NULL;
1241 }
1242 Py_DECREF(o); /* the owned reference in sem_dict doesn't count! */
1243 }
1244 /* set up the status data */
1245 arg.buf = &(o->ds);
1246 if (semctl(o->semid, 0, IPC_STAT, arg) == -1) {
1247 Py_DECREF(o);
1248 PyErr_SetString(PyShm_Error,
1249 "can't access semaphore");
1250 return NULL;
1251 }
1252 return (PyObject *)o;
1253 }
File: | src/extensions/shmmodule.c |
Function: | PyShm_semaphore |
Error: | ob_refcnt of '*keyo' is 1 too high |
1211 static PyObject *
1212 PyShm_semaphore(
1213 PyObject *self,
1214 PyObject *args)
1215 {
1216 int semid;
1217 PyShmSemObj *o;
1218 PyObject *keyo;
1219 semctl_arg arg;
1220
1221 if (!PyArg_ParseTuple(args, "i", &semid))
when PyArg_ParseTuple() succeeds
taking False path
1222 return NULL;
1223 keyo = PyInt_FromLong(semid);
when PyInt_FromLong() succeeds
PyIntObject allocated at: keyo = PyInt_FromLong(semid);
ob_refcnt is now refs: 1 + N where N >= 0
1224 /* get the object from the dictionary */
1225 if (PyMapping_HasKey(sem_dict, keyo)) {
when considering value == (int)0 from src/extensions/shmmodule.c:1225
taking False path
1226 o = (PyShmSemObj *)PyDict_GetItem(sem_dict, keyo);
1227 Py_INCREF(o);
1228 }
1229 else {
1230 /* not found, create it */
1231 if ((o = PyObject_NEW(PyShmSemObj, &PyShmSemaphore_Type)) == NULL)
when PyObject_Init() succeeds
taking False path
1232 return NULL;
1233 o->semid = semid;
1234 o->opflag = 0;
1235 /* sem_dict[semid] = o */
1236 if (PyDict_SetItem(sem_dict, keyo, (PyObject *)o) == -1) {
when treating unknown struct PyObject * from src/extensions/shmmodule.c:196 as non-NULL
when PyDict_SetItem() fails
taking True path
1237 Py_DECREF(o);
when taking True path
1238 PyErr_SetString(PyShm_Error,
calling PyErr_SetString()
1239 "can't initialize semaphore object");
1240 return NULL;
1241 }
1242 Py_DECREF(o); /* the owned reference in sem_dict doesn't count! */
1243 }
1244 /* set up the status data */
1245 arg.buf = &(o->ds);
1246 if (semctl(o->semid, 0, IPC_STAT, arg) == -1) {
1247 Py_DECREF(o);
1248 PyErr_SetString(PyShm_Error,
1249 "can't access semaphore");
1250 return NULL;
1251 }
1252 return (PyObject *)o;
1253 }
ob_refcnt of '*keyo' is 1 too high
was expecting final ob_refcnt to be N + 0 (for some unknown N)
but final ob_refcnt is N + 1
found 2 similar trace(s) to this
File: | src/extensions/shmmodule.c |
Function: | PyShm_semaphore |
Error: | calling PyDict_GetItem with NULL as argument 2 (keyo) at src/extensions/shmmodule.c:1226 |
1211 static PyObject *
1212 PyShm_semaphore(
1213 PyObject *self,
1214 PyObject *args)
1215 {
1216 int semid;
1217 PyShmSemObj *o;
1218 PyObject *keyo;
1219 semctl_arg arg;
1220
1221 if (!PyArg_ParseTuple(args, "i", &semid))
when PyArg_ParseTuple() succeeds
taking False path
1222 return NULL;
1223 keyo = PyInt_FromLong(semid);
when PyInt_FromLong() fails
1224 /* get the object from the dictionary */
1225 if (PyMapping_HasKey(sem_dict, keyo)) {
when considering range: -0x80000000 <= value <= -1
taking True path
1226 o = (PyShmSemObj *)PyDict_GetItem(sem_dict, keyo);
when treating unknown struct PyObject * from src/extensions/shmmodule.c:196 as non-NULL
calling PyDict_GetItem with NULL as argument 2 (keyo) at src/extensions/shmmodule.c:1226
PyDict_GetItem() invokes Py_TYPE() on the pointer via the PyString_CheckExact() macro, thus accessing (NULL)->ob_type
found 1 similar trace(s) to this
1227 Py_INCREF(o);
1228 }
1229 else {
1230 /* not found, create it */
1231 if ((o = PyObject_NEW(PyShmSemObj, &PyShmSemaphore_Type)) == NULL)
1232 return NULL;
1233 o->semid = semid;
1234 o->opflag = 0;
1235 /* sem_dict[semid] = o */
1236 if (PyDict_SetItem(sem_dict, keyo, (PyObject *)o) == -1) {
1237 Py_DECREF(o);
1238 PyErr_SetString(PyShm_Error,
1239 "can't initialize semaphore object");
1240 return NULL;
1241 }
1242 Py_DECREF(o); /* the owned reference in sem_dict doesn't count! */
1243 }
1244 /* set up the status data */
1245 arg.buf = &(o->ds);
1246 if (semctl(o->semid, 0, IPC_STAT, arg) == -1) {
1247 Py_DECREF(o);
1248 PyErr_SetString(PyShm_Error,
1249 "can't access semaphore");
1250 return NULL;
1251 }
1252 return (PyObject *)o;
1253 }
File: | src/extensions/shmmodule.c |
Function: | PyShm_semaphore |
Error: | calling PyDict_SetItem with NULL as argument 2 (keyo) at src/extensions/shmmodule.c:1236 |
1211 static PyObject *
1212 PyShm_semaphore(
1213 PyObject *self,
1214 PyObject *args)
1215 {
1216 int semid;
1217 PyShmSemObj *o;
1218 PyObject *keyo;
1219 semctl_arg arg;
1220
1221 if (!PyArg_ParseTuple(args, "i", &semid))
when PyArg_ParseTuple() succeeds
taking False path
1222 return NULL;
1223 keyo = PyInt_FromLong(semid);
when PyInt_FromLong() fails
1224 /* get the object from the dictionary */
1225 if (PyMapping_HasKey(sem_dict, keyo)) {
when considering value == (int)0 from src/extensions/shmmodule.c:1225
taking False path
1226 o = (PyShmSemObj *)PyDict_GetItem(sem_dict, keyo);
1227 Py_INCREF(o);
1228 }
1229 else {
1230 /* not found, create it */
1231 if ((o = PyObject_NEW(PyShmSemObj, &PyShmSemaphore_Type)) == NULL)
when PyObject_Init() succeeds
taking False path
1232 return NULL;
1233 o->semid = semid;
1234 o->opflag = 0;
1235 /* sem_dict[semid] = o */
1236 if (PyDict_SetItem(sem_dict, keyo, (PyObject *)o) == -1) {
when treating unknown struct PyObject * from src/extensions/shmmodule.c:196 as non-NULL
calling PyDict_SetItem with NULL as argument 2 (keyo) at src/extensions/shmmodule.c:1236
PyDict_SetItem() invokes Py_TYPE() on the pointer via the PyString_CheckExact() macro, thus accessing (NULL)->ob_type
1237 Py_DECREF(o);
1238 PyErr_SetString(PyShm_Error,
1239 "can't initialize semaphore object");
1240 return NULL;
1241 }
1242 Py_DECREF(o); /* the owned reference in sem_dict doesn't count! */
1243 }
1244 /* set up the status data */
1245 arg.buf = &(o->ds);
1246 if (semctl(o->semid, 0, IPC_STAT, arg) == -1) {
1247 Py_DECREF(o);
1248 PyErr_SetString(PyShm_Error,
1249 "can't access semaphore");
1250 return NULL;
1251 }
1252 return (PyObject *)o;
1253 }