SQLite Forum

Memory Leak in pathsearch function
Login

Memory Leak in pathsearch function

(1) By Kleber (kleber) on 2020-07-23 20:49:03 [source]

I would like to make a suggestion for improvement in the lemon.c file.

See that at line 3537 we allocate memory and at line 3553 we release this memory. That's great!

However, at line 3538 we allocate this memory space:

path = (char *) malloc (lemonStrlen (pathlist) + lemonStrlen (name) +2);

But we don't deallocate anywhere in the code. This path is only used by the tplt_open function. In this case, I suggest to deallocate that memory space after the tplt_open function has finished running because it will no longer be needed.