diff --git a/backends/hostmem.c b/backends/hostmem.c index 9d251cc0b704c69346abd7e0885a92972dd955f9..925ce3cd7e1f6929d3ef8bcfd88327b1fecc829c 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -393,7 +393,7 @@ static int mbind_by_proportions(void *ptr, const char *bind_proportions, uint64_ long size_token; DECLARE_BITMAP(tmp_host_nodes, MAX_NODES + 1) = {0}; - ptr = (void*)((char*)ptr + size); + ptr = (void*)((char *)ptr + size); if (memcpy(prop, proportions[i], strlen(proportions[i]) + 1) == NULL) { qemu_log("failed to copy propertion"); return -1; @@ -474,6 +474,7 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp) if (proportion != NULL) { if (mbind_by_proportions(ptr, proportion, sz) < 0) { error_setg(errp, "failed to mbind_by_proportions"); + free(backend->propertion); return; } free(backend->propertion);