File: src/hash_template.c
Function: ALG_hexdigest
Error: memory leak: ob_refcnt of new ref from (unknown) PyBytes_FromStringAndSize is 1 too high
133 static PyObject *
134 ALG_hexdigest(ALGobject *self, PyObject *args)
135 {
136 	PyObject *value, *retval;
137 	unsigned char *raw_digest, *hex_digest;
138 	int i, j, size;
139 
140 	if (!PyArg_ParseTuple(args, ""))
when PyArg_ParseTuple() succeeds
taking False path
141 		return NULL;
142 
143 	/* Get the raw (binary) digest value */
144 	value = (PyObject *)hash_digest(&(self->st));
when hash_digest() succeeds
145 	size = PyBytes_Size(value);
146 	raw_digest = (unsigned char *) PyBytes_AsString(value);
147 
148 	/* Create a new string */
149 	retval = PyBytes_FromStringAndSize(NULL, size * 2 );
when PyBytes_FromStringAndSize() succeeds
new ref from (unknown) PyBytes_FromStringAndSize was allocated at: 	retval = PyBytes_FromStringAndSize(NULL, size * 2 );
ob_refcnt is now refs: 1 owned
150 	hex_digest = (unsigned char *) PyBytes_AsString(retval);
151 
152 	/* Make hex version of the digest */
153 	for(i=j=0; i<size; i++)
when considering range: 1 <= size <= 0x7fffffffffffffff
taking True path
when considering size == (Py_ssize_t)1 from src/hash_template.c:145
taking False path
154 	{
155 		char c;
156 		c = raw_digest[i] / 16; c = (c>9) ? c+'a'-10 : c + '0';
when treating unknown unsigned char * from src/hash_template.c:156 as non-NULL
when considering range: 10 <= value <= 15
taking True path
157 		hex_digest[j++] = c;
when treating unknown unsigned char * from src/hash_template.c:157 as non-NULL
158 		c = raw_digest[i] % 16; c = (c>9) ? c+'a'-10 : c + '0';
when treating unknown unsigned char * from src/hash_template.c:158 as non-NULL
when considering range: 10 <= value <= 15
taking True path
159 		hex_digest[j++] = c;
when treating unknown unsigned char * from src/hash_template.c:159 as non-NULL
160 	}
161 #ifdef IS_PY3K
162 	/* Create a text string return value */
163 	retval = PyUnicode_FromEncodedObject(retval,"latin-1","strict");
when PyUnicode_FromEncodedObject() succeeds
164 #endif
165 
166 	Py_DECREF(value);
when taking True path
167 	return retval;
memory leak: ob_refcnt of new ref from (unknown) PyBytes_FromStringAndSize is 1 too high
was expecting final owned ob_refcnt of new ref from (unknown) PyBytes_FromStringAndSize to be 0 since nothing references it but final ob_refcnt is refs: 1 owned
found 9 similar trace(s) to this
168 }

File: src/hash_template.c
Function: ALG_hexdigest
Error: memory leak: ob_refcnt of '*retval' is 1 too high
133 static PyObject *
134 ALG_hexdigest(ALGobject *self, PyObject *args)
135 {
136 	PyObject *value, *retval;
137 	unsigned char *raw_digest, *hex_digest;
138 	int i, j, size;
139 
140 	if (!PyArg_ParseTuple(args, ""))
when PyArg_ParseTuple() succeeds
taking False path
141 		return NULL;
142 
143 	/* Get the raw (binary) digest value */
144 	value = (PyObject *)hash_digest(&(self->st));
when hash_digest() succeeds
145 	size = PyBytes_Size(value);
146 	raw_digest = (unsigned char *) PyBytes_AsString(value);
147 
148 	/* Create a new string */
149 	retval = PyBytes_FromStringAndSize(NULL, size * 2 );
when PyBytes_FromStringAndSize() succeeds
'*retval' was allocated at: 	retval = PyBytes_FromStringAndSize(NULL, size * 2 );
ob_refcnt is now refs: 1 owned
150 	hex_digest = (unsigned char *) PyBytes_AsString(retval);
151 
152 	/* Make hex version of the digest */
153 	for(i=j=0; i<size; i++)
when considering range: 1 <= size <= 0x7fffffffffffffff
taking True path
when considering size == (Py_ssize_t)1 from src/hash_template.c:145
taking False path
154 	{
155 		char c;
156 		c = raw_digest[i] / 16; c = (c>9) ? c+'a'-10 : c + '0';
when treating unknown unsigned char * from src/hash_template.c:156 as non-NULL
when considering range: 10 <= value <= 15
taking True path
157 		hex_digest[j++] = c;
when treating unknown unsigned char * from src/hash_template.c:157 as non-NULL
158 		c = raw_digest[i] % 16; c = (c>9) ? c+'a'-10 : c + '0';
when treating unknown unsigned char * from src/hash_template.c:158 as non-NULL
when considering range: 10 <= value <= 15
taking True path
159 		hex_digest[j++] = c;
when treating unknown unsigned char * from src/hash_template.c:159 as non-NULL
160 	}
161 #ifdef IS_PY3K
162 	/* Create a text string return value */
163 	retval = PyUnicode_FromEncodedObject(retval,"latin-1","strict");
when PyUnicode_FromEncodedObject() fails
164 #endif
165 
166 	Py_DECREF(value);
when taking True path
167 	return retval;
memory leak: ob_refcnt of '*retval' is 1 too high
was expecting final owned ob_refcnt of '*retval' to be 0 since nothing references it but final ob_refcnt is refs: 1 owned
found 9 similar trace(s) to this
168 }