xinetd/connection.c-fix-pointer-dereference-before-NULL-che.patch
2019-09-30 11:20:12 -04:00

34 lines
909 B
Diff

From 316adda751b9a871da0fd447210512723ee9814b Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Wed, 16 May 2012 08:55:08 +0200
Subject: [PATCH 04/16] connection.c: fix pointer dereference before NULL check
---
xinetd/connection.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/xinetd/connection.c b/xinetd/connection.c
index f01ae0d..7ba6261 100644
--- a/xinetd/connection.c
+++ b/xinetd/connection.c
@@ -165,13 +165,15 @@ connection_s *conn_new( struct service *sp )
*/
void conn_free( connection_s *cp, int release_mem )
{
- struct service *sp = cp->co_sp ;
+ struct service *sp ;
if( cp == NULL )
return;
if( debug.on )
msg( LOG_INFO, "conn_free", "freeing connection") ;
+ sp = cp->co_sp ;
+
if( (SVC_SOCKET_TYPE( sp ) == SOCK_DGRAM) && (SVC_IS_ACTIVE( sp )) )
drain( cp->co_descriptor ) ;
--
2.19.1