aboutsummaryrefslogtreecommitdiff
path: root/lib/install.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2020-06-03 00:10:25 -0400
committerGitHub <noreply@github.com>2020-06-03 00:10:25 -0400
commitd12170bb0cb936f1e48a677dbd96822db55bbda3 (patch)
tree1bd69fbd6460dff6f50e7a13e54693a534590104 /lib/install.c
parent6c140c35ae7bf2b5e6633f63e2bc2fba14fc22bc (diff)
downloadspmc-d12170bb0cb936f1e48a677dbd96822db55bbda3.tar.gz
Refactor fstree (#39)
* Refactor fstree, fstree_free, FSTree type * Add FSRec structure * Refactor fstree usage * Decrease starting size of FSTree structure * Check if ManifestPackage is NULL, not if the requirements array if NULL * Use num_requirements instead of '!= NULL' * Add fstree test
Diffstat (limited to 'lib/install.c')
-rw-r--r--lib/install.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/install.c b/lib/install.c
index 282c662..a2fdf9f 100644
--- a/lib/install.c
+++ b/lib/install.c
@@ -344,8 +344,11 @@ int spm_do_install(SPM_Hierarchy *fs, ManifestList *mf, StrList *packages) {
}
// free requirements array
- for (size_t i = 0; requirements != NULL && requirements[i] != NULL; i++) {
- manifest_package_free(requirements[i]);
+ for (size_t i = 0; i < num_requirements; i++) {
+ if (requirements[i] != NULL) {
+ manifest_package_free(requirements[i]);
+ requirements[i] = NULL;
+ }
}
free(package_dir);