diff --git a/cpp/protoutils.cc b/cpp/protoutils.cc index 5459715..4c4c6d8 100644 --- a/cpp/protoutils.cc +++ b/cpp/protoutils.cc @@ -23,6 +23,14 @@ namespace f8 return hdr; } + void MsgHdr::Destroy(MsgHdr* hdr) + { + if (hdr->buf) { + free((void*)hdr->buf); + } + free((void*)hdr); + } + int Net_GetMessageId(::google::protobuf::Message& msg) { std::string msgname; diff --git a/cpp/protoutils.h b/cpp/protoutils.h index 859e578..9902cc7 100644 --- a/cpp/protoutils.h +++ b/cpp/protoutils.h @@ -94,6 +94,7 @@ namespace f8 const void* user_data = nullptr; MsgHdr* Clone(); + static void Destroy(MsgHdr* hdr); }; #ifdef MATCHVS