From 27a63a76afb1b85e56603128a3f85229ba4550b2 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 10 Mar 2009 11:13:32 +0000 Subject: [PATCH] * src/xend_internal.c: fix an allocation problem in xenDaemonDomainLookupByName_ids Daniel --- ChangeLog | 5 +++++ src/xend_internal.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e6047663d2..b7126f9dac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 10 12:03:37 CET 2009 Daniel Veillard + + * src/xend_internal.c: fix an allocation problem in + xenDaemonDomainLookupByName_ids + Tue Mar 10 10:29:46 GMT 2009 Daniel P. Berrange * src/xend_internal.c: Fix tap vs vbd type for block detach diff --git a/src/xend_internal.c b/src/xend_internal.c index 772f3f45fc..c6d6fa49f1 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -904,7 +904,15 @@ xenDaemonListDomainsOld(virConnectPtr xend) count++; } - if (VIR_ALLOC_N(ptr, count + 1 + extra) < 0) + /* + * We can'tuse the normal allocation routines as we are mixing + * an array of char * at the beginning followed by an array of char + * ret points to the NULL terminated array of char * + * ptr points to the current string after that array but in the same + * allocated block + */ + if (virAlloc((void *)&ptr, + (count + 1) * sizeof(char *) + extra * sizeof(char)) < 0) goto error; ret = (char **) ptr; -- GitLab