diff options
-rw-r--r-- | common.h | 1 | ||||
-rw-r--r-- | main.c | 9 |
2 files changed, 10 insertions, 0 deletions
@@ -61,5 +61,6 @@ void die(const char *m); // initialize global struct Buffer to null/zero values void editor_init(void); +void editor_deinit(void); #endif // _COMMON_H @@ -99,6 +99,7 @@ main(int argc, char *argv[]) err = print_rows(0, B.numrows); if (err < 0) die("print_rows"); + editor_deinit(); return EXIT_SUCCESS; } @@ -120,3 +121,11 @@ editor_init(void) B.rows = NULL; B.last_err = ""; } + +void +editor_deinit(void) +{ + for (int i = 0; i < B.numrows; ++i) { free(B.rows[i].chars); } + free(B.rows); + free(B.filename); +} |