|
From: Chris B. <buc...@us...> - 2012-07-02 21:08:39
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SFCB - Small Footprint CIM Broker".
The branch, master has been updated
via 2fcf9c2ef882d9e5ef6a152ac5169b60b68154aa (commit)
from f2b9c05c7b13844039009806325e536b50264385 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 2fcf9c2ef882d9e5ef6a152ac5169b60b68154aa
Author: buccella <buc...@li...>
Date: Mon Jul 2 16:28:39 2012 -0400
[ 1901737 ] Memory leak in internalProvider.c
-----------------------------------------------------------------------
Summary of changes:
diff --git a/internalProvider.c b/internalProvider.c
index c330ceb..71c68ec 100644
--- a/internalProvider.c
+++ b/internalProvider.c
@@ -636,6 +636,7 @@ getRefs(const CMPIContext *ctx, const CMPIResult *rslt,
/*
* for an unknown class we just return nothing
*/
+ refs->ft->release(refs);
_SFCB_RETURN(st);
}
path = CMNewObjectPath(_broker, ns, assocClass, NULL);
@@ -731,6 +732,7 @@ getRefs(const CMPIContext *ctx, const CMPIResult *rslt,
CMPIInstance *ci;
UtilHashTable *assocs =
UtilFactory->newHashTable(61, UtilHashTable_charKey);
+ assocs->ft->setReleaseFunctions(assocs, free, NULL);
UtilStringBuffer *pn = normalizeObjectPathStrBuf(cop);
for (ci = refs->ft->getFirst(refs); ci; ci = refs->ft->getNext(refs)) {
// Q: for ASSOC_NAME we should not require the
@@ -748,8 +750,9 @@ getRefs(const CMPIContext *ctx, const CMPIResult *rslt,
CMPIInstance *aci =
CBGetInstance(Broker, ctx, data.value.ref, propertyList,
&st);
- assocs->ft->put(assocs, an->ft->getCharPtr(an), aci);
+ assocs->ft->put(assocs, strdup(an->ft->getCharPtr(an)), aci);
}
+ an->ft->release(an);
}
}
@@ -764,7 +767,7 @@ getRefs(const CMPIContext *ctx, const CMPIResult *rslt,
CMPIString *tns = CMGetNameSpace(ref, NULL);
if (tns == NULL || tns->hdl == NULL)
CMSetNameSpace(ref, ns);
- UtilStringBuffer *an = NULL;
+ UtilStringBuffer *an = NULL; /* alloc'd in objectPathEquals() */
if (objectPathEquals(pn, ref, &an, 0) == 0) {
if (resultClass == NULL
@@ -772,8 +775,9 @@ getRefs(const CMPIContext *ctx, const CMPIResult *rslt,
CMPIInstance *aci =
CBGetInstance(Broker, ctx, ref, propertyList, &st);
if (aci)
- assocs->ft->put(assocs, an->ft->getCharPtr(an), aci);
+ assocs->ft->put(assocs, strdup(an->ft->getCharPtr(an)), aci);
}
+ an->ft->release(an);
}
}
}
diff --git a/providerMgr.c b/providerMgr.c
index a7d47d5..8185025 100644
--- a/providerMgr.c
+++ b/providerMgr.c
@@ -363,7 +363,7 @@ lookupProviders(long type, char *className, char *nameSpace,
lst = (*ht)->ft->get(*ht, id);
if (lst == NULL) {
- lst = UtilFactory->newList(memAddUtilList, memUnlinkEncObj);
+ lst = UtilFactory->newList(NULL, NULL);
if ((rc = addProviders(type, className, nameSpace, lst))) {
lst->ft->release(lst);
free(id);
@@ -618,6 +618,7 @@ addAssocProviders(char *className, char *nameSpace,
for (child = children->ft->getFirst(children); child;
child = children->ft->getNext(children)) {
rc = addAssocProviders(child, nameSpace, providerList);
+ free(child); //added from addProviders()
if (rc)
_SFCB_RETURN(rc);
}
@@ -649,7 +650,7 @@ getAssocProviders(char *className, char *nameSpace)
lst = assocProvidersHt->ft->get(assocProvidersHt, key);
}
if (lst == NULL) {
- lst = UtilFactory->newList(memAddUtilList, memUnlinkEncObj);
+ lst = UtilFactory->newList(NULL, NULL);
if (addAssocProviders(className, nameSpace, lst)) {
lst->ft->release(lst);
_SFCB_RETURN(NULL);
@@ -1830,7 +1831,7 @@ _getConstClassChildren(const char *ns, const char *cn)
localInvokeMethod(&binCtx, path, "getchildren", in, &out, &rc, 0);
if (out) {
ar = CMGetArg(out, "children", &rc).value.array;
- ul = UtilFactory->newList(memAddUtilList, memUnlinkEncObj);
+ ul = UtilFactory->newList(NULL, NULL);
for (i = 0, m = CMGetArrayCount(ar, NULL); i < m; i++) {
str = CMGetArrayElementAt(ar, i, NULL).value.string;
if (str && str->hdl)
@@ -1848,6 +1849,7 @@ _getConstClassChildren(const char *ns, const char *cn)
_SFCB_RETURN(ul);
}
+/* basically this is _getConstClassChildren for assoc classes */
static UtilList *
_getAssocClassNames(const char *ns)
{
@@ -1865,8 +1867,9 @@ _getAssocClassNames(const char *ns)
int i,
m,
irc;
+ CMPIString *str;
- _SFCB_TRACE(1, ("--- for %s", ns));
+ _SFCB_TRACE(1, ("--- _getAssocClassNames for %s", ns));
path = NewCMPIObjectPath(ns, "$ClassProvider$", &rc);
req.nameSpace = setCharsMsgSegment((char *) ns);
req.className = setCharsMsgSegment("$ClassProvider$");
@@ -1878,13 +1881,12 @@ _getAssocClassNames(const char *ns)
data = localInvokeMethod(&binCtx, path, "getassocs", in, &out, &rc, 0);
if (out) {
ar = CMGetArg(out, "assocs", &rc).value.array;
- ul = UtilFactory->newList(memAddUtilList, memUnlinkEncObj);
+ ul = UtilFactory->newList(NULL, NULL);
for (i = 0, m = CMGetArrayCount(ar, NULL); i < m; i++) {
- char *name =
- CMGetArrayElementAt(ar, i, NULL).value.string->hdl;
- if (name)
- ul->ft->append(ul, name);
- _SFCB_TRACE(1, ("--- assoc %s", name));
+ str = CMGetArrayElementAt(ar, i, NULL).value.string;
+ if (str && str->hdl)
+ ul->ft->append(ul, strdup(str->hdl));
+ _SFCB_TRACE(1, ("--- assoc %s", str->hdl));
}
}
}
hooks/post-receive
--
SFCB - Small Footprint CIM Broker
|