Fix bug for multiple extras of message.
authorKIM JungYong <jyong2.kim@samsung.com>
Tue, 4 Oct 2016 05:06:36 +0000 (14:06 +0900)
committerUze Choi <uzchoi@samsung.com>
Mon, 10 Oct 2016 01:08:03 +0000 (01:08 +0000)
When the receive multiple extras in the message from notification provider,
consuemr service misparse as parsing just one extras for incorrect operation of pointers.
In this patch, incorrect operation of pointers is fixed.

Change-Id: Ifacaf247ca836d81031ffe93b0b72d2b46db65f3
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/12745
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
(cherry picked from commit cb699f9e7b6fede0c32c254aa5572e349854ea30)
Reviewed-on: https://gerrit.iotivity.org/gerrit/12901

service/notification/src/consumer/NSConsumerCommunication.c

index 0554a01..c9a85f2 100644 (file)
@@ -350,18 +350,22 @@ OCRepPayload * NSGetExtraInfo(OCRepPayload * payload)
             if (isFirstExtra)
             {
                 headValue = curValue;
+                extraInfo->values = headValue;
                 isFirstExtra = false;
             }
-            curValue = curValue->next;
+            else
+            {
+                headValue->next = curValue;
+                headValue = curValue;
+            }
             curValue = NULL;
         }
         value = value->next;
     }
     OCRepPayloadDestroy(origin);
 
-    extraInfo->values = headValue;
 
-    if (extraInfo->values)
+    if (!isFirstExtra && extraInfo->values)
     {
         return extraInfo;
     }