Browse Source

Fix double decref after failed PyList_SetItem in C tokenizer (#361)

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/363/head
zivenger 4 months ago
committed by GitHub
parent
commit
c501415a48
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 1 deletions
  1. +0
    -1
      src/mwparserfromhell/parser/ctokenizer/tok_parse.c

+ 0
- 1
src/mwparserfromhell/parser/ctokenizer/tok_parse.c View File

@@ -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);


Loading…
Cancel
Save