commit - c8fa56b383beaceb4c0baf2bdccc551fe003f035
commit + 96b72a8e59762459b768550828282251000959a4
blob - c4541aaca8aa1f54d98df05ab902e5be210e0145
blob + 4bac848313a6cbddd55ea6a3c66e5db3e9876abe
--- lib/pack_create.c
+++ lib/pack_create.c
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;