Skip to content

Commit 43e2af2

Browse files
committed
install: Enabled installing binary dependencies. Fix some memory issues.
1 parent a7d1744 commit 43e2af2

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

deps/url/url.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ url_parse (const char *url) {
175175
int pathname_len = (int)strlen(pathname);
176176
data->pathname = pathname;
177177

178-
char *search = (char *) malloc(sizeof(search));
178+
char *search = (char *) malloc(strlen(tmp_path)+1);
179179
if (!search) {
180180
free(tmp_url);
181181
url_free(data);
@@ -190,7 +190,7 @@ url_parse (const char *url) {
190190
int search_len = (int)strlen(search);
191191
free(tmp_path);
192192

193-
char *query = (char *) malloc(sizeof(char));
193+
char *query = (char *) malloc(search_len+1);
194194
if (!query) {
195195
free(tmp_url);
196196
url_free(data);
@@ -199,7 +199,7 @@ url_parse (const char *url) {
199199
sscanf(search, "?%s", query);
200200
data->query = query;
201201

202-
char *hash = (char *) malloc(sizeof(char));
202+
char *hash = (char *) malloc(strlen(path)+1);
203203
if (!hash) {
204204
free(tmp_url);
205205
url_free(data);

src/common/clib-package-installer.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ int clib_package_install_executable(clib_package_t *pkg, const char *dir, int ve
195195
E_FORMAT(&file, "%s-%s.tar.gz", reponame, pkg->version);
196196
E_FORMAT(&tarball, "%s/%s", tmp, file);
197197

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

200201
if (0 != rc) {
@@ -517,6 +518,7 @@ int clib_package_install(clib_package_t *pkg, const char *dir, int verbose) {
517518
repository_file_free(handles[j]);
518519
}
519520
#endif
521+
free(handles);
520522

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

542-
// TODO, check if we want to enable this.
543-
//if (pkg->install) {
544-
// rc = clib_package_install_executable(pkg, dir, verbose);
545-
//}
544+
if (pkg->install) {
545+
rc = clib_package_install_executable(pkg, dir, verbose);
546+
}
546547

547548
if (0 == rc) {
548549
rc = clib_package_install_dependencies(pkg, dir, verbose);

0 commit comments

Comments
 (0)