summaryrefslogtreecommitdiffstats
path: root/src/msgfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/msgfile.c')
-rw-r--r--src/msgfile.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/msgfile.c b/src/msgfile.c
index 278b9a7d..1f11aa60 100644
--- a/src/msgfile.c
+++ b/src/msgfile.c
@@ -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;