Commit Diff


commit - 678cfb9b87e886cfa180bf01335908e0e4acba1a
commit + ee7b409c1f35a02e204ac2e248414c19d73d6f41
blob - 2c40dd27410656d72dc97861165aa3e079c53685
blob + 2cbbf71a546f3f77fd06cbc0c0b37a15db83bfcf
--- lib/pack_create.c
+++ lib/pack_create.c
@@ -866,11 +866,19 @@ add_object(int want_meta, struct got_object_idset *ids
 		(*nfound)++;
 		err = report_progress(progress_cb, progress_arg, rl,
 		    *ncolored, *nfound, *ntrees, 0L, 0, 0, 0, 0);
-		if (err)
+		if (err) {
+			clear_meta(m);
+			free(m);
 			return err;
+		}
 	}
 
-	return got_object_idset_add(idset, id, m);
+	err = got_object_idset_add(idset, id, m);
+	if (err) {
+		clear_meta(m);
+		free(m);
+	}
+	return err;
 }
 
 static const struct got_error *
blob - 1762478cd1b25a54000746ddafdece60dda8283d
blob + fac056e27fdaad60303e17cfd5dcd95ca749eab2
--- lib/reference.c
+++ lib/reference.c
@@ -1568,8 +1568,10 @@ add_object_id_map_entry(struct got_object_idset *idset
 
 		TAILQ_INIT(&ent->refs);
 		err = got_object_idset_add(idset, id, ent);
-		if (err)
+		if (err) {
+			free(ent);
 			return err;
+		}
 	}
 
 	err = got_reflist_entry_dup(&new, re);