mirror of https://gerrit.osmocom.org/libosmocore
memleak: osmo_config_list_parse: getline() needs free also on error
Helps fix sanitizer build on debian 9. Change-Id: Iddf0a6cc733cd81d5f6c1eb62fc079ad319db119
This commit is contained in:
parent
b93f60f7cd
commit
00393e1a04
|
@ -119,9 +119,10 @@ struct osmo_config_list *osmo_config_list_parse(void *ctx, const char *filename)
|
|||
line = NULL;
|
||||
while (getline(&line, &n, file) != -1) {
|
||||
handle_line(entries, line);
|
||||
free(line);
|
||||
line = NULL;
|
||||
}
|
||||
/* The returned getline() buffer needs to be freed even if it failed. It can simply re-use the
|
||||
* buffer that was allocated on the first call. */
|
||||
free(line);
|
||||
|
||||
fclose(file);
|
||||
return entries;
|
||||
|
|
Loading…
Reference in New Issue