commit 9f4f302a43f7e186910d59f9dbe0f839b6f2d565 from: Stefan Sperling date: Tue Jun 07 16:04:15 2022 UTC free id and path in load_packed_tree_ids() on error, else they would leak pointed out by op@ commit - f09728336c4d35bfa49210e640b1ceb8989fe3d5 commit + 9f4f302a43f7e186910d59f9dbe0f839b6f2d565 blob - c148b0c64ac4412a9bfc2da3e193337b4cc91238 blob + fff58b083aa8eadb970ebd09ce593455d223fcc9 --- lib/pack_create.c +++ lib/pack_create.c @@ -1520,13 +1520,21 @@ load_packed_tree_ids(void *arg, struct got_tree_object if (tree == NULL) { free(a->id); a->id = got_object_id_dup(id); - if (a->id == NULL) - return got_error_from_errno("got_object_id_dup"); + if (a->id == NULL) { + err = got_error_from_errno("got_object_id_dup"); + free(a->dpath); + a->dpath = NULL; + return err; + } free(a->dpath); a->dpath = strdup(dpath); - if (a->dpath == NULL) - return got_error_from_errno("strdup"); + if (a->dpath == NULL) { + err = got_error_from_errno("strdup"); + free(a->id); + a->id = NULL; + return err; + } a->mtime = mtime; return NULL;