@@ -51,7 +51,7 @@ struct item {
5151 const char * pkgname ;
5252 const char * pkgver ;
5353 char * sha256 ;
54- const char * target ;
54+ char * target ;
5555 uint64_t size ;
5656 enum type type ;
5757 /* index is the index of the package update/install/removal in the transaction
@@ -534,7 +534,8 @@ collect_file(struct xbps_handle *xhp, const char *file, size_t size,
534534 item -> old .preserve = preserve ;
535535 item -> old .update = update ;
536536 item -> old .removepkg = removepkg ;
537- item -> old .target = target ;
537+ if (target )
538+ item -> old .target = strdup (target );
538539 if (sha256 )
539540 item -> old .sha256 = strdup (sha256 );
540541 } else {
@@ -546,7 +547,8 @@ collect_file(struct xbps_handle *xhp, const char *file, size_t size,
546547 item -> new .preserve = preserve ;
547548 item -> new .update = update ;
548549 item -> new .removepkg = removepkg ;
549- item -> new .target = target ;
550+ if (target )
551+ item -> new .target = strdup (target );
550552 }
551553 if (item -> old .type && item -> new .type ) {
552554 /*
@@ -777,6 +779,8 @@ cleanup(void)
777779 free (item -> file );
778780 free (item -> old .sha256 );
779781 free (item -> new .sha256 );
782+ free (item -> old .target );
783+ free (item -> new .target );
780784 free (item );
781785 }
782786 free (items );
@@ -874,6 +878,7 @@ xbps_transaction_files(struct xbps_handle *xhp, xbps_object_iterator_t iter)
874878 update , removepkg , preserve , true);
875879 if (rv != 0 )
876880 goto out ;
881+ xbps_object_release (filesd );
877882 }
878883 }
879884 xbps_object_iterator_reset (iter );
0 commit comments