Переглянути джерело

Fix double decref after failed PyList_SetItem in C tokenizer

PyList_SetItem steals the item reference even on failure, so the error path must not call Py_DECREF on the same object.

Co-authored-by: Cursor <cursoragent@cursor.com>
pull/361/head
zivenger 4 місяці тому
джерело
коміт
65d27ef6cd
1 змінених файлів з 0 додано та 1 видалено
  1. +0
    -1
      src/mwparserfromhell/parser/ctokenizer/tok_parse.c

+ 0
- 1
src/mwparserfromhell/parser/ctokenizer/tok_parse.c Переглянути файл

@@ -1753,7 +1753,6 @@ Tokenizer_handle_single_tag_end(Tokenizer *self)
return NULL;
}
if (PyList_SetItem(self->topstack->stack, index, token)) {
Py_DECREF(token);
return NULL;
}
return Tokenizer_pop(self);


Завантаження…
Відмінити
Зберегти