From 9ffc4278029b111ea32d2420054ea680fc24ada4 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 9 Jun 2020 10:29:30 +0200 Subject: [PATCH] topology: fix the error path in load() Signed-off-by: Jaroslav Kysela --- topology/topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/topology/topology.c b/topology/topology.c index ad0d108..01b2b06 100644 --- a/topology/topology.c +++ b/topology/topology.c @@ -106,14 +106,14 @@ static int load(const char *source_file, void **dst, size_t *dst_size) } buf = buf2; } - if (fd != fileno(stdin)) - close(fd); if (r < 0) { fprintf(stderr, _("Read error: %s\n"), strerror(-errno)); - free(buf); goto _err; } + if (fd != fileno(stdin)) + close(fd); + *dst = buf; *dst_size = pos; return 0; -- 2.47.1