Fix unhappy path cleanup.

The whole while (cnt-- >= 0) idiom is busted since cnt started
at 0 and if the first call to PyUnicode_FromStringAndSize() fails
then we're attempting to access -1.
This commit is contained in:
Joris Vink 2022-02-20 21:25:18 +01:00
parent daca80f1cb
commit a7aa51d8d5
1 changed files with 2 additions and 2 deletions

View File

@ -1274,8 +1274,8 @@ python_runtime_http_request(void *addr, struct http_request *req)
req->cgroups[idx].rm_eo - req->cgroups[idx].rm_so);
if (cargs[cnt] == NULL) {
while (cnt-- >= 0)
Py_XDECREF(cargs[cnt]);
while (cnt >= 0)
Py_XDECREF(cargs[cnt--]);
kore_python_log_error("http request");
http_response(req,
HTTP_STATUS_INTERNAL_ERROR, NULL, 0);