File: addrinfoquery.c
Function: AddrInfoQuery_get_done
Error: ob_refcnt of '*tu' is 1 too high
34 static PyObject *AddrInfoQuery_get_done(AddrInfoQuery *self)
35 {
36 	PyObject *out = NULL;
37 	int r;
38 	struct addrinfo *ai, *i;
39 	if(self->query.result != NULL)
40 	{
when treating unknown struct PyObject * from addrinfoquery.c:40 as NULL
taking False path
41 		out = self->query.result;
42 		Py_INCREF(out);
43 		goto get_done_end;
44 	}
45 	r = asyncns_getaddrinfo_done(self->query.asyncns->asyncns,
46 	                             self->query.asyncns_query, &ai);
when treating unknown struct Asyncns * from addrinfoquery.c:46 as non-NULL
47 	asyncns_del_query(self->query.asyncns, (Query*)self);
48 	if(r != 0)
49 	{
when considering value == (int)0 from addrinfoquery.c:46
taking False path
50 		libasyncns_set_gaierror(r);
51 		out = NULL;
52 		goto get_done_end;
53 	}
54 	out = PyList_New(0);
55 	for (i = ai; i; i = i->ai_next)
when PyList_New() succeeds
56 	{
when treating unknown struct addrinfo * * from addrinfoquery.c:46 as non-NULL
taking True path
when treating unknown struct addrinfo * from addrinfoquery.c:56 as NULL
taking False path
57 		char t[256];
58 		const char *p = NULL;
59 		PyObject *tu = PyTuple_New(5);
60 		PyObject *sockaddr = NULL;
when PyTuple_New() succeeds
PyTupleObject allocated at: 		PyObject *tu = PyTuple_New(5);
ob_refcnt is now refs: 1 + N where N >= 0
61 		
62 		if (i->ai_family == PF_INET)
63 		{
when considering range: -0x80000000 <= value <= 1
taking False path
64 			sockaddr = PyTuple_New(2);
65 			struct sockaddr_in *si = (struct sockaddr_in*)i->ai_addr;
66 			p = inet_ntop(AF_INET, &si->sin_addr, t, sizeof(t));
67 #if PY_MAJOR_VERSION >= 3
68 			PyTuple_SetItem(sockaddr, 0, PyUnicode_FromString(p));
69 			PyTuple_SetItem(sockaddr, 1, PyLong_FromLong(ntohs(si->sin_port)));
70 #else /* PY_MAJOR_VERSION >= 3 */
71 			PyTuple_SetItem(sockaddr, 0, PyString_FromString(p));
72 			PyTuple_SetItem(sockaddr, 1, PyInt_FromLong(ntohs(si->sin_port)));
73 #endif /* PY_MAJOR_VERSION >= 3 */
74 		}
75 		else if (i->ai_family == PF_INET6)
76 		{
when considering range: -0x80000000 <= value <= 9
taking False path
77 			sockaddr = PyTuple_New(4);
78 			struct sockaddr_in6 *s6 = (struct sockaddr_in6*)i->ai_addr;
79 			p = inet_ntop(AF_INET6, &s6->sin6_addr, t, sizeof(t));
80 #if PY_MAJOR_VERSION >= 3
81 			PyTuple_SetItem(sockaddr, 0, PyUnicode_FromString(p));
82 			PyTuple_SetItem(sockaddr, 1, PyLong_FromLong(ntohs(s6->sin6_port)));
83 			PyTuple_SetItem(sockaddr, 2, PyLong_FromLong(ntohl(s6->sin6_flowinfo)));
84 			PyTuple_SetItem(sockaddr, 3, PyLong_FromLong(ntohl(s6->sin6_scope_id)));
85 #else /* PY_MAJOR_VERSION >= 3 */
86 			PyTuple_SetItem(sockaddr, 0, PyString_FromString(p));
87 			PyTuple_SetItem(sockaddr, 1, PyInt_FromLong(ntohs(s6->sin6_port)));
88 			PyTuple_SetItem(sockaddr, 2, PyInt_FromLong(ntohl(s6->sin6_flowinfo)));
89 			PyTuple_SetItem(sockaddr, 3, PyInt_FromLong(ntohl(s6->sin6_scope_id)));
90 #endif /* PY_MAJOR_VERSION >= 3 */
91 		}
92 #if PY_MAJOR_VERSION >= 3
93 		PyTuple_SetItem(tu, 0, PyLong_FromLong(i->ai_family));
94 		PyTuple_SetItem(tu, 1, PyLong_FromLong(i->ai_socktype));
95 		PyTuple_SetItem(tu, 2, PyLong_FromLong(i->ai_protocol));
96 		PyTuple_SetItem(tu, 3, PyUnicode_FromString(i->ai_canonname?i->ai_canonname:""));
97 #else /* PY_MAJOR_VERSION >= 3 */
98 		PyTuple_SetItem(tu, 0, PyInt_FromLong(i->ai_family));
99 		PyTuple_SetItem(tu, 1, PyInt_FromLong(i->ai_socktype));
when PyInt_FromLong() succeeds
when PyTuple_SetItem() succeeds
100 		PyTuple_SetItem(tu, 2, PyInt_FromLong(i->ai_protocol));
when PyInt_FromLong() succeeds
when PyTuple_SetItem() succeeds
101 		PyTuple_SetItem(tu, 3, PyString_FromString(i->ai_canonname?i->ai_canonname:""));
when PyInt_FromLong() fails
when PyTuple_SetItem() succeeds
102 #endif /* PY_MAJOR_VERSION >= 3 */
when treating unknown char * from addrinfoquery.c:102 as non-NULL
taking True path
when treating unknown char * from addrinfoquery.c:102 as non-NULL
when PyString_FromString() succeeds
when PyTuple_SetItem() succeeds
103 		PyTuple_SetItem(tu, 4, sockaddr);
104 		PyList_Append(out, tu);
when PyTuple_SetItem() succeeds
105 	}
when PyList_Append() succeeds
ob_refcnt is now refs: 2 + N where N >= 0
'*tu' is now referenced by 1 non-stack value(s): PyListObject.ob_item[0]
106 	Query_store_result(&(self->query), out);
107 	asyncns_freeaddrinfo(ai);
108 get_done_end:
109 	self->query.asyncns_query = NULL;
110 	return out;
111 }
returning
ob_refcnt of '*tu' is 1 too high
was expecting final ob_refcnt to be N + 1 (for some unknown N)
due to object being referenced by: PyListObject.ob_item[0]
but final ob_refcnt is N + 2
found 9 similar trace(s) to this
112 

File: addrinfoquery.c
Function: AddrInfoQuery_get_done
Error: returning (PyObject*)NULL without setting an exception
34 static PyObject *AddrInfoQuery_get_done(AddrInfoQuery *self)
35 {
36 	PyObject *out = NULL;
37 	int r;
38 	struct addrinfo *ai, *i;
39 	if(self->query.result != NULL)
40 	{
when treating unknown struct PyObject * from addrinfoquery.c:40 as NULL
taking False path
41 		out = self->query.result;
42 		Py_INCREF(out);
43 		goto get_done_end;
44 	}
45 	r = asyncns_getaddrinfo_done(self->query.asyncns->asyncns,
46 	                             self->query.asyncns_query, &ai);
when treating unknown struct Asyncns * from addrinfoquery.c:46 as non-NULL
47 	asyncns_del_query(self->query.asyncns, (Query*)self);
48 	if(r != 0)
49 	{
when considering range: -0x80000000 <= value <= -1
taking True path
50 		libasyncns_set_gaierror(r);
51 		out = NULL;
52 		goto get_done_end;
53 	}
54 	out = PyList_New(0);
55 	for (i = ai; i; i = i->ai_next)
56 	{
57 		char t[256];
58 		const char *p = NULL;
59 		PyObject *tu = PyTuple_New(5);
60 		PyObject *sockaddr = NULL;
61 		
62 		if (i->ai_family == PF_INET)
63 		{
64 			sockaddr = PyTuple_New(2);
65 			struct sockaddr_in *si = (struct sockaddr_in*)i->ai_addr;
66 			p = inet_ntop(AF_INET, &si->sin_addr, t, sizeof(t));
67 #if PY_MAJOR_VERSION >= 3
68 			PyTuple_SetItem(sockaddr, 0, PyUnicode_FromString(p));
69 			PyTuple_SetItem(sockaddr, 1, PyLong_FromLong(ntohs(si->sin_port)));
70 #else /* PY_MAJOR_VERSION >= 3 */
71 			PyTuple_SetItem(sockaddr, 0, PyString_FromString(p));
72 			PyTuple_SetItem(sockaddr, 1, PyInt_FromLong(ntohs(si->sin_port)));
73 #endif /* PY_MAJOR_VERSION >= 3 */
74 		}
75 		else if (i->ai_family == PF_INET6)
76 		{
77 			sockaddr = PyTuple_New(4);
78 			struct sockaddr_in6 *s6 = (struct sockaddr_in6*)i->ai_addr;
79 			p = inet_ntop(AF_INET6, &s6->sin6_addr, t, sizeof(t));
80 #if PY_MAJOR_VERSION >= 3
81 			PyTuple_SetItem(sockaddr, 0, PyUnicode_FromString(p));
82 			PyTuple_SetItem(sockaddr, 1, PyLong_FromLong(ntohs(s6->sin6_port)));
83 			PyTuple_SetItem(sockaddr, 2, PyLong_FromLong(ntohl(s6->sin6_flowinfo)));
84 			PyTuple_SetItem(sockaddr, 3, PyLong_FromLong(ntohl(s6->sin6_scope_id)));
85 #else /* PY_MAJOR_VERSION >= 3 */
86 			PyTuple_SetItem(sockaddr, 0, PyString_FromString(p));
87 			PyTuple_SetItem(sockaddr, 1, PyInt_FromLong(ntohs(s6->sin6_port)));
88 			PyTuple_SetItem(sockaddr, 2, PyInt_FromLong(ntohl(s6->sin6_flowinfo)));
89 			PyTuple_SetItem(sockaddr, 3, PyInt_FromLong(ntohl(s6->sin6_scope_id)));
90 #endif /* PY_MAJOR_VERSION >= 3 */
91 		}
92 #if PY_MAJOR_VERSION >= 3
93 		PyTuple_SetItem(tu, 0, PyLong_FromLong(i->ai_family));
94 		PyTuple_SetItem(tu, 1, PyLong_FromLong(i->ai_socktype));
95 		PyTuple_SetItem(tu, 2, PyLong_FromLong(i->ai_protocol));
96 		PyTuple_SetItem(tu, 3, PyUnicode_FromString(i->ai_canonname?i->ai_canonname:""));
97 #else /* PY_MAJOR_VERSION >= 3 */
98 		PyTuple_SetItem(tu, 0, PyInt_FromLong(i->ai_family));
99 		PyTuple_SetItem(tu, 1, PyInt_FromLong(i->ai_socktype));
100 		PyTuple_SetItem(tu, 2, PyInt_FromLong(i->ai_protocol));
101 		PyTuple_SetItem(tu, 3, PyString_FromString(i->ai_canonname?i->ai_canonname:""));
102 #endif /* PY_MAJOR_VERSION >= 3 */
103 		PyTuple_SetItem(tu, 4, sockaddr);
104 		PyList_Append(out, tu);
105 	}
106 	Query_store_result(&(self->query), out);
107 	asyncns_freeaddrinfo(ai);
108 get_done_end:
109 	self->query.asyncns_query = NULL;
110 	return out;
111 }
returning
returning (PyObject*)NULL without setting an exception
112