Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions diff-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ struct delta_index * create_delta_index(const void *buf, size_t bufsize)
hmask = hsize - 1;

/* allocate lookup index */
memsize = sizeof(*hash) * hsize +
sizeof(*entry) * entries;
memsize = st_add(st_mult(sizeof(*hash), hsize),
st_mult(sizeof(*entry), entries));
mem = malloc(memsize);
if (!mem)
return NULL;
Expand Down Expand Up @@ -258,9 +258,9 @@ struct delta_index * create_delta_index(const void *buf, size_t bufsize)
* Now create the packed index in array form
* rather than linked lists.
*/
memsize = sizeof(*index)
+ sizeof(*packed_hash) * (hsize+1)
+ sizeof(*packed_entry) * entries;
memsize = st_add3(sizeof(*index),
st_mult(sizeof(*packed_hash), hsize + 1),
st_mult(sizeof(*packed_entry), entries));
mem = malloc(memsize);
if (!mem) {
free(hash);
Expand Down
Loading