aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-03-06 13:31:46 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-03-06 13:31:46 +0000
commit91dcd39ee38e082a2d1343e632c5de1165958e7e (patch)
tree94ecf08a2bc2f5a58277ee17031a3de19e087d0d /URPM.xs
parentec6a5a5827bb4f0f5adc310a6f5c76cc6997925c (diff)
downloadperl-URPM-91dcd39ee38e082a2d1343e632c5de1165958e7e.tar
perl-URPM-91dcd39ee38e082a2d1343e632c5de1165958e7e.tar.gz
perl-URPM-91dcd39ee38e082a2d1343e632c5de1165958e7e.tar.bz2
perl-URPM-91dcd39ee38e082a2d1343e632c5de1165958e7e.tar.xz
perl-URPM-91dcd39ee38e082a2d1343e632c5de1165958e7e.zip
It wasn't a good idea to completely remove the refcount, because it's used to
free the underlying C glue structure. Also, and rpmtsLink was misplaced.
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs8
1 files changed, 5 insertions, 3 deletions
diff --git a/URPM.xs b/URPM.xs
index 4468c8c..97ab09f 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -50,6 +50,7 @@ struct s_Package {
struct s_Transaction {
rpmts ts;
+ int count;
};
struct s_TransactionData {
@@ -2631,6 +2632,7 @@ Db_open(prefix="", write_perm=0)
CODE:
read_config_files(0);
db = malloc(sizeof(struct s_Transaction));
+ db->count = 1;
db->ts = rpmtsCreate();
rpmtsSetRootDir(db->ts, prefix);
if (rpmtsOpenDB(db->ts, write_perm ? O_RDWR | O_CREAT : O_RDONLY) == 0) {
@@ -2661,7 +2663,7 @@ Db_DESTROY(db)
URPM::DB db
CODE:
rpmtsFree(db->ts);
- free(db);
+ if (!--db->count) free(db);
int
Db_traverse(db,callback)
@@ -2757,8 +2759,8 @@ Db_traverse_tag(db,tag,names,callback)
++count;
}
rpmdbFreeIterator(mi);
+ rpmtsFree(db->ts);
}
- rpmtsFree(db->ts);
} else croak("bad arguments list");
RETVAL = count;
OUTPUT:
@@ -2784,7 +2786,7 @@ Trans_DESTROY(trans)
URPM::Transaction trans
CODE:
rpmtsFree(trans->ts);
- free(trans);
+ if (!--trans->count) free(trans);
void
Trans_set_script_fd(trans, fdno)