diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2006-03-06 13:31:46 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2006-03-06 13:31:46 +0000 |
commit | 91dcd39ee38e082a2d1343e632c5de1165958e7e (patch) | |
tree | 94ecf08a2bc2f5a58277ee17031a3de19e087d0d | |
parent | ec6a5a5827bb4f0f5adc310a6f5c76cc6997925c (diff) | |
download | perl-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.
-rw-r--r-- | URPM.xs | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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) |