On 21.05.2013 00:38, Eric Blake wrote:
On 05/20/2013 11:55 AM, Michal Privoznik wrote:
> ---
> src/conf/capabilities.c | 30 ++++-------
> src/conf/cpu_conf.c | 20 ++++----
> src/conf/domain_conf.c | 119 ++++++++++++--------------------------------
> src/conf/domain_event.c | 41 +++++++--------
> src/conf/node_device_conf.c | 28 +++++------
> src/conf/nwfilter_conf.c | 17 ++-----
> src/conf/nwfilter_params.c | 34 ++++---------
> src/conf/snapshot_conf.c | 11 ++--
> src/conf/storage_conf.c | 13 ++---
> src/conf/virchrdev.c | 12 ++---
> 10 files changed, 107 insertions(+), 218 deletions(-)
>
> }
> @@ -392,17 +392,14 @@ virCapabilitiesAddGuest(virCapsPtr caps,
> if (VIR_ALLOC(guest) < 0)
> goto no_memory;
>
> - if ((guest->ostype = strdup(ostype)) == NULL)
> + if (VIR_STRDUP(guest->ostype, ostype) < 0)
> goto no_memory;
Local double-oom. You might want to clean this one up now.
You mean s/no_memory/error/ ? Because even if the label is called
no_memory not every label does call virReportOOMError(), like in this case.
>
> guest->arch.id = arch;
> guest->arch.wordsize = virArchGetWordSize(arch);
>
> - if (emulator &&
> - (guest->arch.defaultInfo.emulator = strdup(emulator)) == NULL)
> - goto no_memory;
> - if (loader &&
> - (guest->arch.defaultInfo.loader = strdup(loader)) == NULL)
> + if (VIR_STRDUP(guest->arch.defaultInfo.emulator, emulator) < 0 ||
> + VIR_STRDUP(guest->arch.defaultInfo.loader, loader) < 0)
> goto no_memory;
another local double-oom. Cleaning now would be nice, but I guess I can
live with the promise of later cleanup of 'no_memory' labels.