diff options
| author | Mason Reed <mason@vector35.com> | 2025-04-11 15:54:10 -0400 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2025-04-29 09:16:13 -0400 |
| commit | d1722c0b34f313590f1f5a1274985433a58a7a5f (patch) | |
| tree | c6af733194de3562d521c3844884594d55667c7e /binaryninjaapi.h | |
| parent | a0c5748dcb488b7b7c4f331d7cbd8f02328033c9 (diff) | |
Fix BNVersionInfo leaking
Diffstat (limited to 'binaryninjaapi.h')
| -rw-r--r-- | binaryninjaapi.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 680b9592..e2275fdc 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -1156,6 +1156,28 @@ namespace BinaryNinja { @addtogroup coreapi @{ */ + struct VersionInfo + { + uint32_t major {}; + uint32_t minor {}; + uint32_t build {}; + std::string channel; + + VersionInfo() = default; + + bool operator<(const VersionInfo &other) const + { + char* smallerChan = BNAllocString(channel.c_str()); + char* largerChan = BNAllocString(other.channel.c_str()); + BNVersionInfo smaller = { major, minor, build, smallerChan }; + BNVersionInfo larger = { other.major, other.minor, other.build, largerChan }; + bool result = BNVersionLessThan(smaller, larger); + BNFreeString(smallerChan); + BNFreeString(largerChan); + return result; + } + }; + std::string EscapeString(const std::string& s); std::string UnescapeString(const std::string& s); @@ -1192,6 +1214,8 @@ namespace BinaryNinja { std::string& output, std::string& errors, bool stdoutIsText = false, bool stderrIsText = true); std::string GetVersionString(); + VersionInfo GetVersionInfo(); + VersionInfo ParseVersionString(const std::string& version); std::string GetLicensedUserEmail(); std::string GetProduct(); std::string GetProductType(); @@ -16836,8 +16860,8 @@ namespace BinaryNinja { std::string GetCommit() const; std::string GetRepository() const; std::string GetProjectData(); - BNVersionInfo GetMinimumVersionInfo() const; - BNVersionInfo GetMaximumVersionInfo() const; + VersionInfo GetMinimumVersionInfo() const; + VersionInfo GetMaximumVersionInfo() const; uint64_t GetLastUpdate(); bool IsViewOnly() const; bool IsBeingDeleted() const; |
