|
@@ -124,6 +124,7 @@ void libpyfcgi_set_headers_buf()
|
124
|
124
|
}
|
125
|
125
|
|
126
|
126
|
repr = PyObject_ASCII(libpyfcgi.headers);
|
|
127
|
+Py_INCREF(repr);
|
127
|
128
|
pyfcgi_log(LOG_DEBUG, "Sending headers : '%s'", PyUnicode_AsUTF8(repr));
|
128
|
129
|
Py_DECREF(repr);
|
129
|
130
|
|
|
@@ -134,6 +135,7 @@ Py_DECREF(repr);
|
134
|
135
|
pyfcgi_log(LOG_ERR, "Unable to get iterator from given headers");
|
135
|
136
|
return;
|
136
|
137
|
}
|
|
138
|
+ Py_INCREF(heads_iter);
|
137
|
139
|
|
138
|
140
|
n_head = 0;
|
139
|
141
|
buf_ptr = libpyfcgi.heads_buf; //buffer pointer
|
|
@@ -142,10 +144,12 @@ Py_DECREF(repr);
|
142
|
144
|
buf_off = 0; //buffer pointer offset
|
143
|
145
|
while((head_tuple = PyIter_Next(heads_iter)))
|
144
|
146
|
{
|
|
147
|
+ Py_INCREF(head_tuple);
|
145
|
148
|
head_seq = PySequence_Fast(head_tuple, "Headers element is not a sequence");
|
146
|
149
|
if((tsz = PySequence_Fast_GET_SIZE(head_seq)) != 2)
|
147
|
150
|
{
|
148
|
151
|
repr = PyObject_ASCII(head_tuple);
|
|
152
|
+ Py_INCREF(repr);
|
149
|
153
|
snprintf(errstr, 256,
|
150
|
154
|
"Headers element expected to have len == 2, but got len %ld for element %ld : %s", tsz, n_head, PyUnicode_AsUTF8(repr));
|
151
|
155
|
Py_DECREF(repr);
|
|
@@ -174,6 +178,7 @@ Py_DECREF(repr);
|
174
|
178
|
goto head_decode_err;
|
175
|
179
|
}
|
176
|
180
|
}
|
|
181
|
+ Py_INCREF(bytes[i]);
|
177
|
182
|
head_str[i] = PyBytes_AsString(bytes[i]);
|
178
|
183
|
|
179
|
184
|
}
|
|
@@ -210,6 +215,8 @@ Py_DECREF(repr);
|
210
|
215
|
}
|
211
|
216
|
|
212
|
217
|
n_head++;
|
|
218
|
+ Py_DECREF(bytes[0]);
|
|
219
|
+ Py_DECREF(bytes[1]);
|
213
|
220
|
Py_DECREF(head_seq);
|
214
|
221
|
Py_DECREF(head_tuple);
|
215
|
222
|
}
|