diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-02-09 11:09:58 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-02-09 11:14:03 +0100 |
| commit | 5ef02c4cb448d5d241971da46f702e8b994d955b (patch) | |
| tree | 029e8c14dbf540c00b03cb3f1c32345d3cde2856 /text.c | |
| parent | 472f6b90676972e0ce682a7e902990ffd97b7f63 (diff) | |
| download | vis-5ef02c4cb448d5d241971da46f702e8b994d955b.tar.gz vis-5ef02c4cb448d5d241971da46f702e8b994d955b.tar.xz | |
text: fix use of uninitialized variable in error path
Diffstat (limited to 'text.c')
| -rw-r--r-- | text.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1109,14 +1109,14 @@ ssize_t text_write_range(Text *txt, Filerange *range, int fd) { /* load the given file as starting point for further editing operations. * to start with an empty document, pass NULL as filename. */ Text *text_load(const char *filename) { + int fd = -1; + size_t size = 0; Text *txt = calloc(1, sizeof *txt); if (!txt) return NULL; Piece *p = piece_alloc(txt); if (!p) goto out; - size_t size = 0; - int fd = -1; lineno_cache_invalidate(&txt->lines); if (filename) { if ((fd = open(filename, O_RDONLY)) == -1) |
