[PATCH] freeing the product info
Ludwig Nussel
ludwig.nussel at gmx.de
Sat Apr 17 15:42:34 EDT 2004
Hi,
Handling of info->product is broken. It just can't work if you assign
something to info->product, free it and then try to access it. That
happens for example when installers have post install scripts.
Since info->product ist created in create_install(), I propose to
free it in delete_install() instead of generate_uninstall(). I
tested the component install and uninstall with Rune HoV, worked
fine with the patch.
Index: loki_setup/install.c
===================================================================
--- loki_setup.orig/install.c 2004-04-17 19:31:46.553443982 +0200
+++ loki_setup/install.c 2004-04-17 19:48:33.033714876 +0200
@@ -1410,6 +1410,12 @@
free(comp->message);
free(comp);
}
+ if(info->product)
+ {
+ loki_closeproduct(info->product);
+ info->product = NULL;
+ }
+
delete_cdrom_install(info);
if ( info->lookup ) {
close_lookup(info->lookup);
@@ -1763,10 +1769,8 @@
product_option_t *option;
struct component_elem *comp;
- if ( info->component ) { /* Component install, the product has already been opened */
- product = info->product;
- component = info->component;
- } else {
+ if(!info->product) {
+ log_debug("create new product");
/* Try to open the product first in case it was installed previously */
product = loki_openproduct(info->name);
if ( ! product ) {
@@ -1779,6 +1783,9 @@
info->product = product;
}
+ product = info->product;
+ component = info->component;
+
if ( product ) {
char buf[PATH_MAX];
struct envvar_elem *var;
@@ -1951,8 +1958,6 @@
snprintf(buf, sizeof(buf), "setup.data/bin/%s/%s/uninstall", detect_os(), detect_arch());
loki_upgrade_uninstall(product, buf, "setup.data/locale");
- /* We must call the following in all cases - component installs even, as we have to save the changes */
- loki_closeproduct(product);
} else {
log_fatal(_("Could not create install log"),
detect_home(), info->name);
cu
Ludwig
--
(o_ Ludwig.Nussel at gmx.de
//\ PGP Key ID: FF8135CE
V_/_ ICQ: 52166811
More information about the Lokisetup
mailing list