Merge pull request #24 from ZeruLight/bug/user-binary-db-leak

actually fix db leak
This commit is contained in:
wish
2022-08-11 16:04:32 +10:00
committed by GitHub

View File

@@ -16,7 +16,8 @@ func handleMsgSysSetUserBinary(s *Session, p mhfpacket.MHFPacket) {
s.server.userBinaryParts[userBinaryPartID{charID: s.charID, index: pkt.BinaryType}] = pkt.RawDataPayload
s.server.userBinaryPartsLock.Unlock()
err := s.server.db.QueryRow("SELECT type2 FROM user_binaries WHERE id=$1", s.charID)
var exists []byte
err := s.server.db.QueryRow("SELECT type2 FROM user_binaries WHERE id=$1", s.charID).Scan(&exists)
if err != nil {
s.server.db.Exec("INSERT INTO user_binaries (id) VALUES ($1)", s.charID)
}