Skip to content

Commit

Permalink
Fix coverity scan issue CID 1546910 (#28266)
Browse files Browse the repository at this point in the history
### Details:
- Fix potential null dereference issue in Unique node implementation in
CPU plugin (CID: 1546910)

### Tickets:
 - [CVS-145092](https://jira.devtools.intel.com/browse/CVS-145092)
  • Loading branch information
aobolensk authored Jan 7, 2025
1 parent 26e5fe9 commit 5059c0e
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/plugins/intel_cpu/src/nodes/unique.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,17 @@ void Unique::flattenTensorExec() {

for (size_t i = 0, j = 0; i < inputLen; ++i) {
auto it = uniq.emplace(srcDataPtr[i], j);
inToOutTmpPtr[i] = it.first->second;
if (it.second) {
if (definedOutputs[FIRST_UNIQUE_IDX]) {
firstTmpPtr[j] = i;
}
++j;
} else {
if (definedOutputs[OCCURRENCES_NUM]) {
occurTmpPtr[inToOutTmpPtr[i]]++;
if (definedOutputs[INPUT_TO_UNIQ_IDX]) {
inToOutTmpPtr[i] = it.first->second;
if (it.second) {
if (definedOutputs[FIRST_UNIQUE_IDX]) {
firstTmpPtr[j] = i;
}
++j;
} else {
if (definedOutputs[OCCURRENCES_NUM]) {
occurTmpPtr[inToOutTmpPtr[i]]++;
}
}
}
}
Expand Down

0 comments on commit 5059c0e

Please sign in to comment.