Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. [PATCH 2/2] gsupplicant:Use g_try_malloc0 instead of
      g_malloc0 (Niraj Kumar Goit)
   2. [PATCH 1/2] gsupplicant:Use g_try_malloc0 instead of
      g_malloc0 (Niraj Kumar Goit)
   3. Re: [PATCH 2/2] gsupplicant:Use g_try_malloc0 instead of
      g_malloc0 (Tomasz Bursztyka)
   4. [PATCH 1/2] gdhcp: Use g_try_malloc instead of g_malloc
      (Niraj Kumar Goit)
   5. [PATCH 2/2] gdhcp: Use g_try_malloc instead of g_malloc
      (Niraj Kumar Goit)
   6. [PATCH] gdhcp: Don't try to remove timer again (Saurav Babu)
   7. [PATCH] peer: Use g_try_malloc instead of g_malloc
      (Niraj Kumar Goit)


----------------------------------------------------------------------

Message: 1
Date: Mon, 25 Jan 2016 15:36:02 +0530
From: Niraj Kumar Goit <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH 2/2] gsupplicant:Use g_try_malloc0 instead of
        g_malloc0
Message-ID: <[email protected]>

As per the connman coding style (doc/coding-style.txt), g_try_malloc0 should
be used instead of g_malloc0.
---
 gsupplicant/supplicant.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 4960ab7..246bef2 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2637,7 +2637,10 @@ static void create_peer_identifier(GSupplicantPeer *peer)
                return;
        }
 
-       peer->identifier = g_malloc0(19);
+       peer->identifier = g_try_malloc0(19);
+       if (!peer->identifier)
+               return;
+
        snprintf(peer->identifier, 19, "%02x%02x%02x%02x%02x%02x",
                                                peer->device_address[0],
                                                peer->device_address[1],
-- 
1.7.9.5




------------------------------

Message: 2
Date: Mon, 25 Jan 2016 15:38:07 +0530
From: Niraj Kumar Goit <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH 1/2] gsupplicant:Use g_try_malloc0 instead of
        g_malloc0
Message-ID: <[email protected]>

As per the connman coding style (doc/coding-style.txt), g_try_malloc0 should
be used instead of g_malloc0.
---
 gsupplicant/supplicant.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 5a0a5e4..4960ab7 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -2765,11 +2765,12 @@ static void peer_property(const char *key, 
DBusMessageIter *iter,
                        peer->widi_ies_length = 0;
                }
 
-               peer->widi_ies = g_malloc0(ie_len * sizeof(unsigned char));
-
-               memcpy(peer->widi_ies, ie, ie_len);
-               peer->widi_ies_length = ie_len;
-               data->services_changed = true;
+               peer->widi_ies = g_try_malloc0(ie_len * sizeof(unsigned char));
+               if (peer->widi_ies) {
+                       memcpy(peer->widi_ies, ie, ie_len);
+                       peer->widi_ies_length = ie_len;
+                       data->services_changed = true;
+               }
        }
 }
 
-- 
1.7.9.5




------------------------------

Message: 3
Date: Mon, 25 Jan 2016 11:34:12 +0100
From: Tomasz Bursztyka <[email protected]>
To: [email protected]
Subject: Re: [PATCH 2/2] gsupplicant:Use g_try_malloc0 instead of
        g_malloc0
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252; format=flowed

Hi,

> As per the connman coding style (doc/coding-style.txt), g_try_malloc0 should
> be used instead of g_malloc0.

If remember well, we had a chat about that a while ago. And we decided 
it does not
make sense to use g_try_malloc0() for a small amount of bytes: if you 
cannot allocate 19 bytes
your are not going to be able to do anything anywhere.

Tomasz


------------------------------

Message: 4
Date: Mon, 25 Jan 2016 15:56:29 +0530
From: Niraj Kumar Goit <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH 1/2] gdhcp: Use g_try_malloc instead of g_malloc
Message-ID: <[email protected]>

As per the connman coding style, g_try_malloc should be used
instead of g_malloc.
---
 gdhcp/client.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdhcp/client.c b/gdhcp/client.c
index f9cba89..0a721cb 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -1840,7 +1840,7 @@ static char *malloc_option_value_string(uint8_t *option, 
GDHCPOptionType type)
                return NULL;
        upper_length = len_of_option_as_string[type] *
                        ((unsigned)len / (unsigned)optlen);
-       dest = ret = g_malloc(upper_length + 1);
+       dest = ret = g_try_malloc(upper_length + 1);
        if (!ret)
                return NULL;
 
-- 
1.7.9.5




------------------------------

Message: 5
Date: Mon, 25 Jan 2016 15:56:30 +0530
From: Niraj Kumar Goit <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH 2/2] gdhcp: Use g_try_malloc instead of g_malloc
Message-ID: <[email protected]>

As per the connman coding style, g_try_malloc should be used
instead of g_malloc.
---
 gdhcp/client.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdhcp/client.c b/gdhcp/client.c
index 0a721cb..af1bb61 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -3134,7 +3134,7 @@ static uint8_t *alloc_dhcpv6_option(uint16_t code, 
uint8_t *option,
 {
        uint8_t *storage;
 
-       storage = g_malloc(2 + 2 + len);
+       storage = g_try_malloc(2 + 2 + len);
        if (!storage)
                return NULL;
 
-- 
1.7.9.5




------------------------------

Message: 6
Date: Mon, 25 Jan 2016 15:57:06 +0530
From: Saurav Babu <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] gdhcp: Don't try to remove timer again
Message-ID:
        <[email protected]>

GLib-CRITICAL warning message is obtained in below scenario:
1. service is connected and link local address is obtained.
2. Try to disconnect service.

(connmand:8377): GLib-CRITICAL **: Source ID 289 was not found when attempting 
to remove it

(connmand:8377): GLib-CRITICAL **: Source ID 303 was not found when attempting 
to remove it

When Link Local IP address is obtained then both dhcp_client->timeout
assigned for DISCOVER_TIMEOUT and ANNOUNCE_INTERVAL are already removed
when discover_timeout() and ipv4ll_announce_timeout() function returns
FALSE but the dhcp_client->timeout is not assigned to 0. Now when
dhcp_release() calls remove_timeouts() function then
dhcp_client->timeout is tried to remove again resulting in GLib-CRITICAL
warning. This patch explicitly sets dhcp_client->timeout to 0 in
discover_timeout() and ipv4ll_announce_timeout() function.
---
 gdhcp/client.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdhcp/client.c b/gdhcp/client.c
index f9cba89..3cbb1ed 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -2626,6 +2626,7 @@ static gboolean discover_timeout(gpointer user_data)
         * option is present.
         */
        g_dhcp_client_start(dhcp_client, NULL);
+       dhcp_client->timeout = 0;
 
        return FALSE;
 }
@@ -2681,6 +2682,7 @@ static gboolean ipv4ll_announce_timeout(gpointer 
dhcp_data)
                dhcp_client->ipv4ll_available_cb(dhcp_client,
                                        dhcp_client->ipv4ll_available_data);
        dhcp_client->conflicts = 0;
+       dhcp_client->timeout = 0;
 
        return FALSE;
 }
-- 
1.9.1



------------------------------

Message: 7
Date: Mon, 25 Jan 2016 16:21:54 +0530
From: Niraj Kumar Goit <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: [PATCH] peer: Use g_try_malloc instead of g_malloc
Message-ID: <[email protected]>

---
 src/peer.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/peer.c b/src/peer.c
index 8a380c9..cad1071 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -706,7 +706,10 @@ struct connman_peer *connman_peer_create(const char 
*identifier)
 {
        struct connman_peer *peer;
 
-       peer = g_malloc0(sizeof(struct connman_peer));
+       peer = g_try_malloc0(sizeof(struct connman_peer));
+       if(!peer)
+               return NULL;
+
        peer->identifier = g_strdup(identifier);
        peer->state = CONNMAN_PEER_STATE_IDLE;
 
-- 
1.7.9.5




------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 3, Issue 18
**************************************

Reply via email to