diff --git a/src/Pegasus/ProviderManager2/CMPI/CMPI_Array.cpp b/src/Pegasus/ProviderManager2/CMPI/CMPI_Array.cpp index a152be5..4612912 100644 --- a/src/Pegasus/ProviderManager2/CMPI/CMPI_Array.cpp +++ b/src/Pegasus/ProviderManager2/CMPI/CMPI_Array.cpp @@ -194,7 +194,17 @@ extern "C" CMSetStatus(rc,CMPI_RC_OK); if (pos < dta->value.uint32) { - return dta[pos+1]; + if (dta->type == CMPI_chars) + { + data.type = CMPI_chars; + data.state = CMPI_goodValue; + data.value.chars = (char*)CMGetCharPtr(dta[pos+1].value.string); + return data; + } + else + { + return dta[pos+1]; + } } CMSetStatus(rc,CMPI_RC_ERR_NO_SUCH_PROPERTY); return data; @@ -227,7 +237,11 @@ extern "C" dta[pos+1].state=CMPI_goodValue; if (type == CMPI_chars) { - dta[pos+1].value.chars = (char*) val; + // Store char* as CMPIString internally, this frees us from + // doing explicit memory management for char*. + dta[pos+1].value.string = reinterpret_cast( + new CMPI_Object((const char*) val)); + dta[pos+1].type = CMPI_string; } else { diff --git a/src/Pegasus/ProviderManager2/CMPI/CMPI_Value.cpp b/src/Pegasus/ProviderManager2/CMPI/CMPI_Value.cpp index 48dd518..d293e40 100644 --- a/src/Pegasus/ProviderManager2/CMPI/CMPI_Value.cpp +++ b/src/Pegasus/ProviderManager2/CMPI/CMPI_Value.cpp @@ -177,7 +177,7 @@ CIMValue value2CIMValue(const CMPIValue* data, const CMPIType type, CMPIrc *rc) else if( aType == CMPI_chars ) { - CopyToStringArray(String,chars) + CopyToStringArray(String,string->hdl) } else if( aType == CMPI_charsptr )