Sfoglia il codice sorgente

Squash a memory leak.

tags/v0.3
Ben Kurtovic 11 anni fa
parent
commit
f1b95758d6
1 ha cambiato i file con 9 aggiunte e 6 eliminazioni
  1. +9
    -6
      mwparserfromhell/parser/tokenizer.c

+ 9
- 6
mwparserfromhell/parser/tokenizer.c Vedi File

@@ -1005,12 +1005,13 @@ static int
Tokenizer_handle_free_link_text(Tokenizer* self, int* parens,
Textbuffer** tail, Py_UNICODE this)
{
#define PUSH_TAIL_BUFFER(tail, error) \
if ((tail)->size || (tail)->next) { \
Tokenizer_emit_textbuffer(self, tail, 0); \
tail = Textbuffer_new(); \
if (!(tail)) \
return error; \
#define PUSH_TAIL_BUFFER(tail, error) \
if ((tail)->size || (tail)->next) { \
if (Tokenizer_emit_textbuffer(self, tail, 0)) \
return error; \
tail = Textbuffer_new(); \
if (!(tail)) \
return error; \
}

if (this == *"(" && !(*parens)) {
@@ -1172,6 +1173,7 @@ static int Tokenizer_parse_external_link(Tokenizer* self, int brackets)
if (!brackets) {
if (Tokenizer_remove_uri_scheme_from_textbuffer(self, link)) {
Textbuffer_dealloc(extra);
Py_DECREF(link);
return -1;
}
}
@@ -1199,6 +1201,7 @@ static int Tokenizer_parse_external_link(Tokenizer* self, int brackets)
}
if (extra->size || extra->next)
return Tokenizer_emit_textbuffer(self, extra, 0);
Textbuffer_dealloc(extra);
return 0;
}



Caricamento…
Annulla
Salva