Skip to content

Commit

Permalink
install: Enabled installing binary dependencies. Fix some memory issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
nouwaarom committed May 2, 2021
1 parent a7d1744 commit 43e2af2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions deps/url/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ url_parse (const char *url) {
int pathname_len = (int)strlen(pathname);
data->pathname = pathname;

char *search = (char *) malloc(sizeof(search));
char *search = (char *) malloc(strlen(tmp_path)+1);
if (!search) {
free(tmp_url);
url_free(data);
Expand All @@ -190,7 +190,7 @@ url_parse (const char *url) {
int search_len = (int)strlen(search);
free(tmp_path);

char *query = (char *) malloc(sizeof(char));
char *query = (char *) malloc(search_len+1);
if (!query) {
free(tmp_url);
url_free(data);
Expand All @@ -199,7 +199,7 @@ url_parse (const char *url) {
sscanf(search, "?%s", query);
data->query = query;

char *hash = (char *) malloc(sizeof(char));
char *hash = (char *) malloc(strlen(path)+1);
if (!hash) {
free(tmp_url);
url_free(data);
Expand Down
9 changes: 5 additions & 4 deletions src/common/clib-package-installer.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ int clib_package_install_executable(clib_package_t *pkg, const char *dir, int ve
E_FORMAT(&file, "%s-%s.tar.gz", reponame, pkg->version);
E_FORMAT(&tarball, "%s/%s", tmp, file);

// TODO, move to repository
rc = http_get_file(url, tarball, NULL, 0);

if (0 != rc) {
Expand Down Expand Up @@ -517,6 +518,7 @@ int clib_package_install(clib_package_t *pkg, const char *dir, int verbose) {
repository_file_free(handles[j]);
}
#endif
free(handles);

#ifdef HAVE_PTHREADS
pthread_mutex_lock(&lock.mutex);
Expand All @@ -539,10 +541,9 @@ int clib_package_install(clib_package_t *pkg, const char *dir, int verbose) {
goto cleanup;
}

// TODO, check if we want to enable this.
//if (pkg->install) {
// rc = clib_package_install_executable(pkg, dir, verbose);
//}
if (pkg->install) {
rc = clib_package_install_executable(pkg, dir, verbose);
}

if (0 == rc) {
rc = clib_package_install_dependencies(pkg, dir, verbose);
Expand Down

0 comments on commit 43e2af2

Please sign in to comment.