forked from soccera/rdo
Fix memory leak in getconf()
As getline() calls malloc() to allocate new memory for our usage, we have to free() it after.
This commit is contained in:
parent
1bb71b46cc
commit
4ed6a6d75a
1 changed files with 1 additions and 0 deletions
1
rdo.c
1
rdo.c
|
@ -24,6 +24,7 @@ void getconf(FILE* fp, const char* entry, char* result, size_t len_result) {
|
|||
if (token) {
|
||||
strncpy(result, token, len_result);
|
||||
result[strcspn(result, "\n")] = 0;
|
||||
free(line);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue