2
0

Don't share inet constant memory between connections

This commit is contained in:
Jack Christensen
2016-05-12 08:00:53 -05:00
parent a488fe026f
commit 90f22c1717
+10 -2
View File
@@ -144,14 +144,22 @@ func connect(config ConnConfig, pgTypes map[Oid]PgType, pgsql_af_inet *byte, pgs
c = new(Conn) c = new(Conn)
c.config = config c.config = config
if pgTypes != nil { if pgTypes != nil {
c.PgTypes = make(map[Oid]PgType, len(pgTypes)) c.PgTypes = make(map[Oid]PgType, len(pgTypes))
for k, v := range pgTypes { for k, v := range pgTypes {
c.PgTypes[k] = v c.PgTypes[k] = v
} }
} }
c.pgsql_af_inet = pgsql_af_inet
c.pgsql_af_inet6 = pgsql_af_inet6 if pgsql_af_inet != nil {
c.pgsql_af_inet = new(byte)
*c.pgsql_af_inet = *pgsql_af_inet
}
if pgsql_af_inet6 != nil {
c.pgsql_af_inet6 = new(byte)
*c.pgsql_af_inet6 = *pgsql_af_inet6
}
if c.config.LogLevel != 0 { if c.config.LogLevel != 0 {
c.logLevel = c.config.LogLevel c.logLevel = c.config.LogLevel