topology: fix possible double free in load()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2021-01-08 18:33:28 +01:00
parent c9b4293212
commit 88513212c5

View file

@ -100,10 +100,8 @@ static int load(const char *source_file, void **dst, size_t *dst_size)
pos += r;
size += 8*1024;
buf2 = realloc(buf, size);
if (buf2 == NULL) {
free(buf);
if (buf2 == NULL)
goto _nomem;
}
buf = buf2;
}
if (r < 0) {