diary

Text-based journaling program
git clone https://git.in0rdr.ch/diary.git
Log | Files | Refs | README | LICENSE

commit 442dafe84d289c80deebc698422b73c411791064
parent 85ece49bf45a0ec4fc59894471eab958552e8290
Author: Andreas Gruhler <agruhl@gmx.ch>
Date:   Sat, 30 Oct 2021 22:06:08 +0200

catch lost memory blocks

Diffstat:
Msrc/diary.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/diary.c b/src/diary.c @@ -371,6 +371,7 @@ int main(int argc, char** argv) { return 0; break; case 'd': + free(CONFIG.dir); // set diary directory from option character CONFIG.dir = (char *) calloc(strlen(optarg) + 1, sizeof(char)); strcpy(CONFIG.dir, optarg); @@ -400,6 +401,7 @@ int main(int argc, char** argv) { } if (optind < argc) { + free(CONFIG.dir); // set diary directory from first non-option argv-element, // required for backwarad compatibility with diary <= 0.4 CONFIG.dir = (char *) calloc(strlen(argv[optind]) + 1, sizeof(char)); @@ -665,6 +667,7 @@ int main(int argc, char** argv) { } while (ch != 'q'); free(config_file_path); + free(CONFIG.dir); endwin(); system("clear"); return 0;