datapath-windows: fix bug in NlBufCopyAtTailUninit
authorNithin Raju <nithin@vmware.com>
Mon, 15 Sep 2014 18:38:01 +0000 (11:38 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 17 Sep 2014 04:33:01 +0000 (21:33 -0700)
We should be returning value of tail before the increment
and not after.

Signed-off-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows/ovsext/Netlink/NetlinkBuf.c

index ba10d83..918bddd 100644 (file)
@@ -213,15 +213,13 @@ done:
 PCHAR
 NlBufCopyAtTailUninit(PNL_BUFFER nlBuf, UINT32 len)
 {
-    PCHAR ret = NULL;
+    PCHAR ret;
 
+    ret = nlBuf->tail;
     if ((NlBufCopyAtTail(nlBuf, NULL, len)) == FALSE) {
-        goto done;
+        ret = NULL;
     }
 
-    ret = nlBuf->tail;
-
-done:
     return ret;
 }