gisi: Fix counter for indication subscriptions
authorAki Niemi <aki.niemi@nokia.com>
Wed, 25 Aug 2010 10:04:38 +0000 (13:04 +0300)
committerAki Niemi <aki.niemi@nokia.com>
Mon, 30 Aug 2010 14:54:40 +0000 (17:54 +0300)
gisi/client.c

index 640484d..e3785a7 100644 (file)
@@ -473,6 +473,7 @@ int g_isi_subscribe(GIsiClient *client, uint8_t type,
 {
        GIsiIndication *ind;
        GIsiIndication **old;
+       gboolean isnew = TRUE;
 
        if (cb == NULL)
                return -EINVAL;
@@ -495,6 +496,7 @@ int g_isi_subscribe(GIsiClient *client, uint8_t type,
        if (*old != ind) {
                g_free(ind);
                ind = *old;
+               isnew = FALSE;
        }
 
        ind->func = cb;
@@ -507,8 +509,11 @@ int g_isi_subscribe(GIsiClient *client, uint8_t type,
                        g_free(ind);
                        return ret;
                }
-               client->inds.count++;
        }
+
+       if (isnew)
+               client->inds.count++;
+
        return 0;
 }