From: Jaroslav Kysela Date: Tue, 9 Jun 2020 08:29:30 +0000 (+0200) Subject: topology: fix the error path in load() X-Git-Tag: v1.2.4~25 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=9ffc4278029b111ea32d2420054ea680fc24ada4;p=alsa-utils.git topology: fix the error path in load() Signed-off-by: Jaroslav Kysela --- 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;