diff options
author | Vicent Marti <tanoku@gmail.com> | 2014-09-02 14:15:24 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2014-09-09 03:39:15 +0200 |
commit | 7e12fdba0c9a444a3cfc29c520e2f2caa57a8232 (patch) | |
tree | f56d01544e7e0d61d1ed1d2c59bb0d0d33e3b8d1 /src/inlines.c | |
parent | c28af79329264a7cf331a1b1c414919e4ed9e9f9 (diff) |
NO SEGFAULTS KTHX
Diffstat (limited to 'src/inlines.c')
-rw-r--r-- | src/inlines.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/inlines.c b/src/inlines.c index b9ece0e..7b48ad9 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -84,7 +84,7 @@ extern reference* lookup_reference(reference** refmap, chunk *label) if (refmap != NULL) { HASH_FIND_STR(*refmap, (char*)norm, ref); } - free(label); + free(norm); return ref; } @@ -262,7 +262,7 @@ inline static unsigned char *chunk_to_cstr(chunk *c) inline static chunk chunk_literal(const char *data) { - chunk c = {data, strlen(data), 0}; + chunk c = {data, data ? strlen(data) : 0, 0}; return c; } @@ -937,6 +937,7 @@ static int find_special_char(subject *subj) while (n < size) { if (strchr("\n\\`&_*[]<!", gh_buf_at(subj->buffer, n))) return n; + n++; } return -1; @@ -974,7 +975,9 @@ static int parse_inline(subject* subj, inl ** last) case '_': if (subj->pos > 0 && (isalnum(gh_buf_at(subj->buffer, subj->pos - 1)) || gh_buf_at(subj->buffer, subj->pos - 1) == '_')) { - goto text_literal; + new = make_str(chunk_literal("_")); + advance(subj); + break; } new = handle_strong_emph(subj, '_'); |