mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
csa/match.c: coverity CID 87204; bad free; WTF
This commit is contained in:
parent
7752966865
commit
2c2fb1151d
1 changed files with 3 additions and 1 deletions
|
@ -220,6 +220,7 @@ _DtCmHashCriteria(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keep == B_TRUE) {
|
if (keep == B_TRUE) {
|
||||||
|
void *savedHattrs = NULL;
|
||||||
if (*hattrs == NULL) {
|
if (*hattrs == NULL) {
|
||||||
if ((*hattrs = (cms_attribute *)calloc(1,
|
if ((*hattrs = (cms_attribute *)calloc(1,
|
||||||
sizeof(cms_attribute)*(num_attrs-i)+
|
sizeof(cms_attribute)*(num_attrs-i)+
|
||||||
|
@ -231,14 +232,15 @@ _DtCmHashCriteria(
|
||||||
free(*hattrs);
|
free(*hattrs);
|
||||||
return (CSA_E_INSUFFICIENT_MEMORY);
|
return (CSA_E_INSUFFICIENT_MEMORY);
|
||||||
} else {
|
} else {
|
||||||
|
savedHattrs = (void *)*hattrs;
|
||||||
*((char**)(*hattrs)) = (char *)&hval[0];
|
*((char**)(*hattrs)) = (char *)&hval[0];
|
||||||
*hattrs = (cms_attribute *)\
|
*hattrs = (cms_attribute *)\
|
||||||
((char *)(*hattrs)+sizeof(char*));
|
((char *)(*hattrs)+sizeof(char*));
|
||||||
}
|
}
|
||||||
if (ops && (*hops = (CSA_enum *)calloc(1,
|
if (ops && (*hops = (CSA_enum *)calloc(1,
|
||||||
sizeof(CSA_enum)*(num_attrs-i))) == NULL) {
|
sizeof(CSA_enum)*(num_attrs-i))) == NULL) {
|
||||||
free(*hattrs);
|
|
||||||
free(hval);
|
free(hval);
|
||||||
|
free(savedHattrs);
|
||||||
return (CSA_E_INSUFFICIENT_MEMORY);
|
return (CSA_E_INSUFFICIENT_MEMORY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue