]> git.alsa-project.org Git - alsa-utils.git/commitdiff
topology: fix the error path in load()
authorJaroslav Kysela <perex@perex.cz>
Tue, 9 Jun 2020 08:29:30 +0000 (10:29 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 9 Jun 2020 08:29:30 +0000 (10:29 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
topology/topology.c

index ad0d108562df112401e254753bce876f226f50c6..01b2b06d7db35d4bb6ccfe290e60ee02a1fb349d 100644 (file)
@@ -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;