summaryrefslogtreecommitdiff
path: root/lib/ofpbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ofpbuf.c')
-rw-r--r--lib/ofpbuf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c
index 271105bde..0330681b2 100644
--- a/lib/ofpbuf.c
+++ b/lib/ofpbuf.c
@@ -436,6 +436,10 @@ ofpbuf_reserve(struct ofpbuf *b, size_t size)
void *
ofpbuf_push_uninit(struct ofpbuf *b, size_t size)
{
+ if (!size) {
+ return b->data;
+ }
+
ofpbuf_prealloc_headroom(b, size);
b->data = (char*)b->data - size;
b->size += size;