From: Marcel Holtmann Date: Mon, 2 Aug 2010 16:02:43 +0000 (-0700) Subject: Fix potential NULL pointer with DHCP plugin and hostname X-Git-Tag: 2.0_alpha~2537 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4fc2968ea3c3237bbb78bcd78391980b0727f06a;p=framework%2Fconnectivity%2Fconnman.git Fix potential NULL pointer with DHCP plugin and hostname --- diff --git a/plugins/dhcp.c b/plugins/dhcp.c index b07a711..1e6b83d 100644 --- a/plugins/dhcp.c +++ b/plugins/dhcp.c @@ -111,6 +111,7 @@ static int dhcp_request(struct connman_dhcp *dhcp) { GDHCPClient *dhcp_client; GDHCPClientError error; + const char *hostname; int index; DBG("dhcp %p", dhcp); @@ -124,8 +125,9 @@ static int dhcp_request(struct connman_dhcp *dhcp) if (getenv("CONNMAN_DHCP_DEBUG")) g_dhcp_client_set_debug(dhcp_client, dhcp_debug, "DHCP"); - g_dhcp_client_set_send(dhcp_client, G_DHCP_HOST_NAME, - connman_utsname_get_hostname()); + hostname = connman_utsname_get_hostname(); + if (hostname != NULL) + g_dhcp_client_set_send(dhcp_client, G_DHCP_HOST_NAME, hostname); g_dhcp_client_set_request(dhcp_client, G_DHCP_HOST_NAME); g_dhcp_client_set_request(dhcp_client, G_DHCP_SUBNET);