Browse files

connection.c: fix pointer dereference before NULL check

  • Loading branch information...
1 parent 4f324c7 commit 316adda751b9a871da0fd447210512723ee9814b @jsynacek committed May 16, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 xinetd/connection.c
View
4 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 ) ;

0 comments on commit 316adda

Please sign in to comment.