Skip to content

Commit

Permalink
Fix a leak in DiskArbitrationEventPublisher::getProperty (osquery#8463)
Browse files Browse the repository at this point in the history
  • Loading branch information
Smjert authored Nov 7, 2024
1 parent b8fbdbb commit 5ff3092
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions osquery/events/darwin/diskarbitration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,11 @@ std::string DiskArbitrationEventPublisher::getProperty(
} else if (CFGetTypeID(value) == CFBooleanGetTypeID()) {
return (CFBooleanGetValue((CFBooleanRef)value)) ? "1" : "0";
} else if (CFGetTypeID(value) == CFUUIDGetTypeID()) {
return stringFromCFString(
CFUUIDCreateString(kCFAllocatorDefault, (CFUUIDRef)value));
auto cf_string = CFUUIDCreateString(kCFAllocatorDefault, (CFUUIDRef)value);
auto string = stringFromCFString(cf_string);
CFRelease(cf_string);
return string;
}
return "";
}
}
} // namespace osquery

0 comments on commit 5ff3092

Please sign in to comment.