vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit bb3ddd3a4cdf7fa2f01d0d811e8f1828e1da4827 parent 5544131e6e3575dd37409fb8c592563013227433 Author: Marc André Tanner <mat@brain-dump.org> Date: Sun, 14 Sep 2014 08:48:07 +0200 All *_free(...) functions should accept a NULL argument Diffstat:
| M | editor.c | | | 2 | ++ |
| M | text.c | | | 2 | ++ |
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/editor.c b/editor.c @@ -377,6 +377,8 @@ err: } void editor_free(Editor *ed) { + if (!ed) + return; while (ed->windows) editor_window_close(ed->windows); editor_prompt_free(ed->prompt); diff --git a/text.c b/text.c @@ -457,6 +457,8 @@ static Change *change_alloc(Text *txt, size_t pos) { } static void change_free(Change *c) { + if (!c) + return; /* only free the new part of the span, the old one is still in use */ piece_free(c->new.start); if (c->new.start != c->new.end)