Hi,

On Wed, 2012-03-21 at 13:08 +0200, Alok Barsode wrote:
> +static GList *ts_list = NULL;

Maybe a GSList is enough here?

>  void __connman_timeserver_sync_next()
>  {
> -     if (system_timeservers == NULL ||
> -     system_timeservers[count] == NULL)
> +     char *server = NULL;
> +     GList *l = NULL;
> +
> +     __connman_ntp_stop();
> +
> +     /* Get the 1st server in the list */
> +     l = g_list_first(ts_list);

list = ts_list; should be enough here.

> +     if(l == NULL)
> +             return;
> +
> +     server = g_strdup(l->data);
> +
> +     ts_list = g_list_delete_link(ts_list, l);

list->data is not removed here, memory leak. Just set server = l->data;
without g_strdup(). server seems to be free'd later on in the function.

> +     for(i=0; service_ts != NULL && service_ts[i] != NULL; i++)
> +             ts_list = g_list_append(ts_list, g_strdup(service_ts[i]));

or g_slist_prepend if ts_list is an GSList.

Cheers,

        Patrik


_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to