| Submitter | Kevin Wolf |
|---|---|
| Date | June 11, 2010, 8:19 a.m. |
| Message ID | <1276244381-7569-1-git-send-email-kwolf@redhat.com> |
| Download | mbox | patch |
| Permalink | /patch/55298/ |
| State | New |
| Headers | show |
Comments
Kevin, this patch works fine. Kevin Wolf wrote: > When dest is NULL, i.e. a new copy of the list is created, we don't > get a > properly terminated list after the realloc. Initialize it as an empty > list. > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> > --- > > Xudong, can you please try this one? I think it should fix your > qemu-img > problem. > > qemu-option.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/qemu-option.c b/qemu-option.c > index acd74f9..f884865 100644 > --- a/qemu-option.c > +++ b/qemu-option.c > @@ -378,6 +378,7 @@ QEMUOptionParameter > *append_option_parameters(QEMUOptionParameter *dest, num_options > += count_option_parameters(list); > > dest = qemu_realloc(dest, (num_options + 1) * > sizeof(QEMUOptionParameter)); + dest[num_dest_options].name = NULL; > > while (list && list->name) { > if (get_option_parameter(dest, list->name) == NULL) {
On 06/11/2010 03:19 AM, Kevin Wolf wrote: > When dest is NULL, i.e. a new copy of the list is created, we don't get a > properly terminated list after the realloc. Initialize it as an empty list. > > Signed-off-by: Kevin Wolf<kwolf@redhat.com> > Applied. Thanks. Regards, Anthony Liguori > --- > > Xudong, can you please try this one? I think it should fix your qemu-img > problem. > > qemu-option.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/qemu-option.c b/qemu-option.c > index acd74f9..f884865 100644 > --- a/qemu-option.c > +++ b/qemu-option.c > @@ -378,6 +378,7 @@ QEMUOptionParameter *append_option_parameters(QEMUOptionParameter *dest, > num_options += count_option_parameters(list); > > dest = qemu_realloc(dest, (num_options + 1) * sizeof(QEMUOptionParameter)); > + dest[num_dest_options].name = NULL; > > while (list&& list->name) { > if (get_option_parameter(dest, list->name) == NULL) { >
Patch
diff --git a/qemu-option.c b/qemu-option.c index acd74f9..f884865 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -378,6 +378,7 @@ QEMUOptionParameter *append_option_parameters(QEMUOptionParameter *dest, num_options += count_option_parameters(list); dest = qemu_realloc(dest, (num_options + 1) * sizeof(QEMUOptionParameter)); + dest[num_dest_options].name = NULL; while (list && list->name) { if (get_option_parameter(dest, list->name) == NULL) {
When dest is NULL, i.e. a new copy of the list is created, we don't get a properly terminated list after the realloc. Initialize it as an empty list. Signed-off-by: Kevin Wolf <kwolf@redhat.com> --- Xudong, can you please try this one? I think it should fix your qemu-img problem. qemu-option.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)