# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1196195250 28800
# Node ID 1d3cf993995a4d162e11890a04cfcbf2446c3ca2
# Parent eeba8399b981b7539a8103fcf1a196e98476073b
Fixes to RAFP for libcmpiutil API change
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r eeba8399b981 -r 1d3cf993995a src/Virt_ResourceAllocationFromPool.c
--- a/src/Virt_ResourceAllocationFromPool.c Tue Nov 27 12:26:46 2007 -0800
+++ b/src/Virt_ResourceAllocationFromPool.c Tue Nov 27 12:27:30 2007 -0800
@@ -43,7 +43,7 @@ static CMPIStatus rasd_to_pool(const CMP
{
CMPIStatus s;
uint16_t type;
- char *id = NULL;
+ const char *id = NULL;
char *poolid = NULL;
virConnectPtr conn = NULL;
struct inst_list _list;
@@ -58,8 +58,7 @@ static CMPIStatus rasd_to_pool(const CMP
goto out;
}
- id = cu_get_str_path(ref, "InstanceID");
- if (id == NULL) {
+ if (cu_get_str_path(ref, "InstanceID", &id) != CMPI_RC_OK) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Missing InstanceID");
@@ -92,7 +91,6 @@ static CMPIStatus rasd_to_pool(const CMP
}
out:
- free(id);
free(poolid);
virConnectClose(conn);
inst_list_free(&_list);
@@ -106,7 +104,7 @@ static int filter_by_pool(struct inst_li
{
int i;
uint16_t type;
- char *rasd_id = NULL;
+ const char *rasd_id = NULL;
char *poolid = NULL;
for (i = 0; i < src->cur; i++) {
@@ -126,8 +124,6 @@ static int filter_by_pool(struct inst_li
poolid = pool_member_of(_BROKER, CLASSNAME(op), type, rasd_id);
if (STREQ(poolid, _poolid))
inst_list_add(dest, inst);
-
- free(rasd_id);
}
return dest->cur;
@@ -182,10 +178,9 @@ static CMPIStatus pool_to_rasd(const CMP
struct inst_list *list)
{
CMPIStatus s;
- char *poolid;
-
- poolid = cu_get_str_path(ref, "InstanceID");
- if (poolid == NULL) {
+ const char *poolid;
+
+ if (cu_get_str_path(ref, "InstanceID", &poolid) != CMPI_RC_OK) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Missing InstanceID");
@@ -222,8 +217,6 @@ static CMPIStatus pool_to_rasd(const CMP
CMSetStatus(&s, CMPI_RC_OK);
out:
- free(poolid);
-
return s;
}