Skip to content

Commit

Permalink
Allocate memory for the btable structure
Browse files Browse the repository at this point in the history
In vr_btable_attach, for the btable metadata, we allocate memory
only for a pointer, while end up using that memory as a structure.
Hence, allocate memory for the whole structrure rather than for
the pointer to the structure.

Change-Id: Iccf2793a6c3bcac06aed9cfe2011e9364e1f9397
Closes-Bug: #1678704
  • Loading branch information
anandhk-juniper committed Apr 3, 2017
1 parent d109c09 commit 300fd13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dp-core/vr_btable.c
Expand Up @@ -181,7 +181,7 @@ vr_btable_attach(struct iovec *iov, unsigned int iov_len,
if (iov[0].iov_len % esize)
return NULL;

alloc_size = sizeof(struct vr_btable *);
alloc_size = sizeof(struct vr_btable);
alloc_size += (sizeof(void *) * iov_len);
alloc_size += (sizeof(struct vr_btable_partition) * iov_len);

Expand Down

0 comments on commit 300fd13

Please sign in to comment.