gmyth/src/gmyth_socket.c
branchtrunk
changeset 468 f4c6061f6f39
parent 464 5ef4452c42cc
child 529 dfa28b22a36c
     1.1 --- a/gmyth/src/gmyth_socket.c	Tue Mar 27 21:42:35 2007 +0100
     1.2 +++ b/gmyth/src/gmyth_socket.c	Wed Mar 28 21:26:42 2007 +0100
     1.3 @@ -492,7 +492,7 @@
     1.4  	const gchar *hostname, gint port, guint timeout)
     1.5  {
     1.6      struct addrinfo *addr_info_data = NULL, *addr_info0 = NULL;
     1.7 -    struct linger* ling = NULL;
     1.8 +    struct linger ling;
     1.9      gchar *tmp_str;
    1.10      gint ret_code = 0; /* -1 */
    1.11      /* FIXME: add as function parameter */
    1.12 @@ -564,12 +564,13 @@
    1.13          g_io_channel_unref (gmyth_socket->sd_io_ch);
    1.14          gmyth_socket->sd_io_ch = NULL;
    1.15      }
    1.16 +   
    1.17 +    	 
    1.18 +    memset (&ling, 0, sizeof (struct linger));
    1.19 +    ling.l_onoff = TRUE;
    1.20 +    ling.l_linger = 1;
    1.21      
    1.22 -    ling = g_malloc0( sizeof(struct linger) );
    1.23 -    ling->l_onoff = TRUE;
    1.24 -    ling->l_linger = 1;
    1.25 -    
    1.26 -    err = setsockopt(gmyth_socket->sd, SOL_SOCKET, SO_LINGER, ling, sizeof(struct linger));
    1.27 +    err = setsockopt(gmyth_socket->sd, SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger));
    1.28  	  
    1.29      if( err < 0 ) {
    1.30          gmyth_debug( "[%s] Setting connection unsucessfull.\n", __FUNCTION__ );
    1.31 @@ -593,9 +594,6 @@
    1.32      ret = ( ret_code == 0 ) ? TRUE : FALSE ;
    1.33  
    1.34  cleanup:
    1.35 -    if ( !ling )
    1.36 -        g_free (ling);
    1.37 -    
    1.38      if ( !ret )
    1.39      	gmyth_debug("GMythSocket error - return code error!");
    1.40      	
    1.41 @@ -1111,7 +1109,7 @@
    1.42      g_free (str_array);
    1.43  
    1.44      /* ptr_array is pointing to data inside str_list->glist */
    1.45 -    g_ptr_array_free (ptr_array, FALSE);
    1.46 +    g_ptr_array_free (ptr_array, TRUE);
    1.47  
    1.48      return TRUE;
    1.49  }