release buffer after use

This commit is contained in:
Darien Raymond 2018-11-12 19:51:21 +01:00
parent 891bdd14fe
commit ee844a2b75
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 2 additions and 0 deletions

View File

@ -22,6 +22,8 @@ func CreateObject(v *Instance, config interface{}) (interface{}, error) {
// By default V2Ray only support config in protobuf format, i.e., configFormat = "protobuf". Caller need to load other packages to add JSON support.
func StartInstance(configFormat string, configBytes []byte) (*Instance, error) {
var mb buf.MultiBuffer
defer mb.Release()
common.Must2(mb.Write(configBytes))
config, err := LoadConfig(configFormat, "", &mb)
if err != nil {