summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/namecache.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source3/libsmb/namecache.c b/source3/libsmb/namecache.c
index f05f76a22b..d985832613 100644
--- a/source3/libsmb/namecache.c
+++ b/source3/libsmb/namecache.c
@@ -93,8 +93,10 @@ static TDB_DATA namecache_value(struct in_addr *ip_list, int num_names,
struct nc_value *value;
int size;
- size = sizeof(struct nc_value) + sizeof(struct in_addr) *
- (num_names-1);
+ size = sizeof(struct nc_value);
+
+ if (num_names > 0)
+ size += sizeof(struct in_addr) * (num_names-1);
value = (struct nc_value *)malloc(size);