X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=qemu-option.c;h=65db54292b051b9434f83ba968ccbc3048f55da7;hb=7ec7f28019dff4ab00ff907f7b4e7261da593279;hp=1f8f41ae7d0742ec7819e5fe9fd1f5868e21287b;hpb=94ac726842d37b50c7742ecb643bebe2e5d72cd2;p=qemu.git diff --git a/qemu-option.c b/qemu-option.c index 1f8f41ae7..65db54292 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -394,8 +394,8 @@ QEMUOptionParameter *append_option_parameters(QEMUOptionParameter *dest, /* * Parses a parameter string (param) into an option list (dest). * - * list is the templace is. If dest is NULL, a new copy of list is created for - * it. If list is NULL, this function fails. + * list is the template option list. If dest is NULL, a new copy of list is + * created. If list is NULL, this function fails. * * A parameter string consists of one or more parameters, separated by commas. * Each parameter consists of its name and possibly of a value. In the latter @@ -416,20 +416,13 @@ QEMUOptionParameter *parse_option_parameters(const char *param, char value[256]; char *param_delim, *value_delim; char next_delim; - size_t num_options; if (list == NULL) { return NULL; } if (dest == NULL) { - // Count valid options - num_options = count_option_parameters(list); - - // Create a copy of the option list to fill in values - dest = qemu_mallocz((num_options + 1) * sizeof(QEMUOptionParameter)); - allocated = dest; - memcpy(dest, list, (num_options + 1) * sizeof(QEMUOptionParameter)); + dest = allocated = append_option_parameters(NULL, list); } while (*param) {