libnfs_zdr_opaque: make valgrind happy
authorPeter Lieven <pl@kamp.de>
Fri, 20 Dec 2013 14:37:17 +0000 (15:37 +0100)
committerPeter Lieven <pl@kamp.de>
Mon, 23 Dec 2013 11:46:31 +0000 (12:46 +0100)
valgrind complains about unitialized memory

Signed-off-by: Peter Lieven <pl@kamp.de>
lib/libnfs-zdr.c

index f5e1a11270291e191d526ce1703e1018061f2567..7539b08d7ccf7776a3f0f6cc52391e5f760ed62d 100644 (file)
@@ -219,6 +219,9 @@ bool_t libnfs_zdr_opaque(ZDR *zdrs, char *objp, uint32_t size)
        case ZDR_ENCODE:
                memcpy(&zdrs->buf[zdrs->pos], objp, size);
                zdrs->pos += size;
+               if (zdrs->pos & 3) {
+                       memset(&zdrs->buf[zdrs->pos], 0x00, 4 - (zdrs->pos & 3));
+               }
                zdrs->pos = (zdrs->pos + 3) & ~3;
                return TRUE;
        case ZDR_DECODE: