tFix memory leak and access error - ve - a minimal text editor (work in progres… | |
git clone git://src.adamsgaard.dk/ve | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit b9155f5bf8853830af6771cf86f226856a46c75e | |
parent aa2240b83487b25ae3ccdddd7120209fbd6d1f89 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Fri, 9 Aug 2019 21:09:54 +0200 | |
Fix memory leak and access error | |
Diffstat: | |
M ve.c | 4 ++-- | |
1 file changed, 2 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/ve.c b/ve.c | |
t@@ -248,6 +248,7 @@ editor_row_update(eRow* row) | |
} | |
row->rchars[idx] = '\0'; | |
row->rsize = idx; | |
+ editor_update_syntax(row); | |
} | |
/* add row to buffer */ | |
t@@ -720,14 +721,12 @@ editor_draw_rows(struct abuf *ab) | |
char buf[16]; | |
for (y = 0; y < E.screen_rows; ++y) { | |
file_row = y + E.row_offset; | |
- editor_update_syntax(&E.row[file_row]); | |
if (file_row < E.num_rows) { | |
len = E.row[file_row].rsize - E.column_offset; | |
if (len < 0) | |
len = 0; | |
if (len > E.screen_columns) | |
len = E.screen_columns; | |
- /* ab_append(ab, &E.row[file_row].rchars[E.column_offs… | |
c = &E.row[file_row].rchars[E.column_offset]; | |
hl = &E.row[file_row].hl[E.column_offset]; | |
for (j = 0; j < len; ++j) { | |
t@@ -1068,6 +1067,7 @@ deinit_editor() { | |
free(E.find_query); | |
for (i=0; i<E.num_rows; ++i) | |
editor_row_free(&E.row[i]); | |
+ free(E.row); | |
} | |
/* set editor state variables, make room for status */ |