Skip to content

Commit 829e12a

Browse files
committed
fix condition
1 parent 92dccdb commit 829e12a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/common/clib-package.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,11 @@ static inline int install_packages(list_t *list, const char *dir, int verbose) {
390390
loop_cleanup:
391391
if (slug)
392392
free(slug);
393-
if (error && pkg)
394-
clib_package_free(pkg);
395393
if (error) {
394+
if (pkg) {
395+
clib_package_free(pkg);
396+
pkg = NULL;
397+
}
396398
list_iterator_destroy(iterator);
397399
iterator = NULL;
398400
rc = -1;
@@ -681,15 +683,13 @@ clib_package_new_from_slug_with_package_name(const char *slug, int verbose,
681683
#else
682684
res = http_get(json_url);
683685
#endif
684-
json = res->data;
685-
_debug("status: %d", res->status);
686686
if (!res || !res->ok) {
687-
if (res) {
688-
http_get_free(res);
689-
res = NULL;
690-
}
687+
http_get_free(res);
688+
res = NULL;
691689
goto download;
692690
}
691+
json = res->data;
692+
_debug("status: %d", res->status);
693693
log = "fetch";
694694
}
695695
}

0 commit comments

Comments
 (0)