Ensure that we don't try to dereference a NULL pointer
authorPavan Deolasee <[email protected]>
Thu, 18 Oct 2018 07:42:45 +0000 (13:12 +0530)
committerPavan Deolasee <[email protected]>
Thu, 18 Oct 2018 07:42:45 +0000 (13:12 +0530)
src/gtm/proxy/proxy_main.c

index 1b905870041b469492a2bfbe752eea7663c7e6a2..871c6a5ee3a4ccbee4c57c0997d31aa2baed96ee 100644 (file)
@@ -1177,9 +1177,12 @@ GTMProxy_ThreadMain(void *argp)
                                 */
                                if (conninfo->con_disconnected)
                                {
-                                       EmitErrorReport(conninfo->con_port);
-                                       if (conninfo->con_port->sock > 0)
-                                               StreamClose(conninfo->con_port->sock);
+                                       if (conninfo->con_port)
+                                       {
+                                               EmitErrorReport(conninfo->con_port);
+                                               if (conninfo->con_port->sock > 0)
+                                                       StreamClose(conninfo->con_port->sock);
+                                       }
                                        GTMProxy_ThreadRemoveConnection(thrinfo, conninfo);
                                        pfree(conninfo);
                                        ii--;