void args_deinit(args_t *args)
{
+ free (args->offline_root);
+ free (args->offline_root_pre_script_cmd);
+ free (args->offline_root_post_script_cmd);
+
+ free (args->dest);
+ free (args->tmp_dir);
free(args->conf_file);
args->conf_file = NULL;
}
/* free the reminaing entries */
for (i = 0; i < hash->n_entries; i++) {
hash_entry_t *hash_entry = (hash->entries + i);
+ free (hash_entry->key);
/* skip the first entry as this is part of the array */
hash_entry = hash_entry->next;
while (hash_entry)
free (p->description);
free (p->tags);
free (p->url);
+ free (p->repository);
free (p);
}
opkg_conf_deinit (opkg->conf);
args_deinit (opkg->args);
+ free (opkg->options);
+ free (opkg->args);
+ free (opkg->conf);
+ free (opkg);
}
int
opkg_install_package (opkg_t *opkg, const char *package_name, opkg_progress_callback_t progress_callback, void *user_data)
{
int err;
- char *package_id = NULL, *stripped_filename;
+ char *stripped_filename;
opkg_progress_data_t pdata;
pkg_t *old, *new;
pkg_vec_t *deps, *all;
pdata.action = OPKG_INSTALL;
progress (pdata, 75);
- if (!package_id)
- package_id = strdup (package_name);
-
/* unpack the package */
err = opkg_install_pkg(opkg->conf, new, 0);
pkg_src_t *src;
int sources_list_count, sources_done;
opkg_progress_data_t pdata;
+ char *tmp_file_name = NULL;
opkg_assert (opkg != NULL);
sprintf_alloc (&list_file_name, "%s/%s", lists_dir, src->name);
if (src->gzip)
{
- char *tmp_file_name;
FILE *in, *out;
struct _curl_cb_data cb_data;
}
else
err = opkg_download (opkg->conf, url, list_file_name, NULL, NULL);
+ free (tmp_file_name);
if (err)
{
sprintf_alloc (&url, "%s/%s", src->value, "Packages.sig");
/* create temporary file for it */
- char *tmp_file_name;
-
sprintf_alloc (&tmp_file_name, "%s/%s", tmp, "Packages.sig");
err = opkg_download (opkg->conf, url, tmp_file_name, NULL, NULL);
free(conf->tmp_dir); /*XXX*/
free(conf->lists_dir);
+ free(conf->pending_dir);
pkg_src_list_deinit(&conf->pkg_src_list);
pkg_dest_list_deinit(&conf->pkg_dest_list);
opkg_message(conf, OPKG_NOTICE, "defaulting architecture %s priority to 10\n", name);
value = strdup("10");
}
- nv_pair_list_append(&conf->arch_list, strdup(name), strdup(value));
+ nv_pair_list_append(&conf->arch_list, name, value);
} else {
fprintf(stderr, "WARNING: Ignoring unknown configuration "
"parameter: %s %s %s\n", type, name, value);
char *tmp_dir;
char *lists_dir;
- const char *pending_dir;
+ char *pending_dir;
/* options */
int autoremove;
free (userpwd);
}
res = curl_easy_perform (curl);
- curl_easy_cleanup (curl);
fclose (file);
if (res)
{
long error_code;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &error_code);
opkg_message(conf, OPKG_ERROR, "Failed to download %s, error %d\n", src, error_code);
+ free(tmp_file_location);
+ free(src_basec);
+ curl_easy_cleanup (curl);
return res;
}
+ curl_easy_cleanup (curl);
}
else
+ {
+ free(tmp_file_location);
+ free(src_basec);
return -1;
+ }
err = file_move(tmp_file_location, dest_file_name);
}
if (ndepends <= 0) {
+ pkg_vec_free(depends);
return 0;
}
signal(SIGINT, old_handler);
else
sigprocmask(SIG_UNBLOCK, &newset, &oldset);
-
+ pkg_vec_free (replacees);
return 0;
else
sigprocmask(SIG_UNBLOCK, &newset, &oldset);
+ pkg_vec_free (replacees);
return err;
}
opkg_set_current_state (conf, OPKG_STATE_NONE, NULL);
free(dependents);
if (err) return err;
}
+ if (dependents)
+ free(dependents);
}
if ( message==0 ){
old->state_want = SW_DEINSTALL;
}
+ free(old_version);
+ free(new_version);
new->state_flag |= SF_USER;
return opkg_install_pkg(conf, new,1);
}
return 0;
}
+void compound_depend_deinit (compound_depend_t *depends)
+{
+ int i;
+ for (i = 0; i < depends->possibility_count; i++)
+ {
+ depend_t *d;
+ d = depends->possibilities[i];
+ free (d->version);
+ free (d);
+ }
+ free (depends->possibilities);
+}
+
void pkg_deinit(pkg_t *pkg)
{
int i;
pkg->state_flag = SF_OK;
pkg->state_status = SS_NOT_INSTALLED;
+ //for (i = 0; i < pkg->replaces_count; i++)
+ free (pkg->replaces);
+ pkg->replaces = NULL;
+
for (i = 0; i < pkg->depends_count; i++)
free (pkg->depends_str[i]);
free(pkg->depends_str);
pkg->depends_str = NULL;
- pkg->depends_count = 0;
for (i = 0; i < pkg->provides_count; i++)
free (pkg->provides_str[i]);
free(pkg->provides_str);
pkg->provides_str = NULL;
- pkg->provides_count = 0;
for (i = 0; i < pkg->conflicts_count; i++)
free (pkg->conflicts_str[i]);
free(pkg->conflicts_str);
pkg->conflicts_str = NULL;
- pkg->conflicts_count = 0;
for (i = 0; i < pkg->replaces_count; i++)
free (pkg->replaces_str[i]);
free(pkg->replaces_str);
pkg->replaces_str = NULL;
- pkg->replaces_count = 0;
for (i = 0; i < pkg->recommends_count; i++)
free (pkg->recommends_str[i]);
free(pkg->recommends_str);
pkg->recommends_str = NULL;
- pkg->recommends_count = 0;
+
+ for (i = 0; i < pkg->suggests_count; i++)
+ free (pkg->suggests_str[i]);
+ free(pkg->suggests_str);
+ pkg->suggests_str = NULL;
if (pkg->depends)
{
int x;
for (x = 0; x < count; x++)
- {
- compound_depend_t *depends;
- depends = &pkg->depends[x];
-
- for (i = 0; i < depends->possibility_count; i++)
- {
- depend_t *d;
- d = depends->possibilities[i];
- free (d->version);
- free (d);
- }
- free (depends->possibilities);
- }
+ compound_depend_deinit (&pkg->depends[x]);
free (pkg->depends);
}
+
+ if (pkg->conflicts)
+ {
+ int x;
+ for (x = 0; x < pkg->conflicts_count; x++)
+ compound_depend_deinit (&pkg->conflicts[x]);
+ free (pkg->conflicts);
+ }
+
free (pkg->provides);
- free (pkg->conflicts);
pkg->pre_depends_count = 0;
free(pkg->pre_depends_str);
}
str_list_deinit(pkg->installed_files);
+ free (pkg->installed_files);
}
pkg->installed_files = NULL;
opkg_message(conf, OPKG_NOTICE, "pkg_write_filelist pkg=%s returned %d\n", pkg->name, err);
}
}
+ pkg_vec_free (installed_pkgs);
return 0;
}
}
abstract_pkg_vec_free (ab_pkg->provided_by);
+ abstract_pkg_vec_free (ab_pkg->replaced_by);
pkg_vec_free (ab_pkg->pkgs);
+ free (ab_pkg->depended_upon_by);
free (ab_pkg->name);
free (ab_pkg);
}
pkg->revision = "";
pkg->familiar_revision = "";
+ if (!pkg->version)
+ {
pkg->version= malloc(strlen(raw)+1);
if ( pkg->version == NULL ) {
fprintf(stderr, "%s: out of memory \n", __FUNCTION__);
return ENOMEM;
}
strcpy(pkg->version, raw);
+ }
hyphen= strrchr(pkg->version,'-');
else if(isGenericFieldType("Installed-Time:", *lines)) {
char *time_str = parseGenericFieldType("Installed-Time", *lines);
pkg->installed_time = strtoul(time_str, NULL, 0);
+ free (time_str);
}
break;
*raw = lines;
/* If the ipk has not a Provides line, we insert our false line */
if ( pkg_false_provides==1)
- pkg->provides_str = parseDependsString ((char *)"Provides: opkg_internal_use_only ", &pkg->provides_count);
+ {
+ pkg->provides_count = 1;
+ pkg->provides_str = malloc (sizeof (char*));
+ pkg->provides_str[0] = strdup ("opkg_internal_use_only");
+ }
if (pkg->name) {
return 0;
void abstract_pkg_vec_free(abstract_pkg_vec_t *vec)
{
+ if (!vec)
+ return;
free(vec->pkgs);
free(vec);
}
package_list_upgradable_callback (opkg_t *opkg, opkg_package_t *pkg, void *data)
{
printf ("%s - %s\n", pkg->name, pkg->version);
+ opkg_package_free (pkg);
}
void
if (pkg)
{
print_package (pkg);
- opkg_package_free (find_pkg);
opkg_package_free (pkg);
}
else
printf ("Package \"%s\" not found!\n", find_pkg->name);
+ opkg_package_free (find_pkg);
}
else
printf ("No package available to test find_package.\n");