Commit Diff


commit - a96621150027f46d946238e99c8236a06f79f0da
commit + 535e07c7d678cfc4a2b6ad61f72c36e0a46e5111
blob - cce652c329299014337427f1496d995ff9e59954
blob + 6c977a92f5e574ca78d050e9d534527d8b10d122
--- lib/send.c
+++ lib/send.c
@@ -320,7 +320,7 @@ realloc_ids(struct got_object_id ***ids, size_t *nallo
 	struct got_object_id **new;
 	const size_t alloc_chunksz = 256;
 
-	if (*nalloc >= n + alloc_chunksz)
+	if (*nalloc >= n)
 		return NULL;
 
 	new = recallocarray(*ids, *nalloc, *nalloc + alloc_chunksz,
@@ -596,7 +596,7 @@ got_send_pack(const char *remote_name, struct got_path
 		 * Also prepare the array of our object IDs which
 		 * will be needed for generating a pack file.
 		 */
-		err = realloc_ids(&our_ids, &nalloc_ours, nours);
+		err = realloc_ids(&our_ids, &nalloc_ours, nours + 1);
 		if (err)
 			goto done;
 		our_ids[nours] = id;
@@ -676,7 +676,7 @@ got_send_pack(const char *remote_name, struct got_path
 			have_their_id = 1;
 		}
 
-		err = realloc_ids(&their_ids, &nalloc_theirs, ntheirs);
+		err = realloc_ids(&their_ids, &nalloc_theirs, ntheirs + 1);
 		if (err)
 			goto done;