aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-06-05 18:41:50 +0000
committerFrancois Pons <fpons@mandriva.com>2003-06-05 18:41:50 +0000
commit707645ab7ba247529060589ecac31c948d333d5a (patch)
tree343649369a225cc5e18e39636eb3daebdce64f83
parent2a0f3bc6f665051cd809d328d4b037c8d2b9ac6d (diff)
downloadperl-URPM-707645ab7ba247529060589ecac31c948d333d5a.tar
perl-URPM-707645ab7ba247529060589ecac31c948d333d5a.tar.gz
perl-URPM-707645ab7ba247529060589ecac31c948d333d5a.tar.bz2
perl-URPM-707645ab7ba247529060589ecac31c948d333d5a.tar.xz
perl-URPM-707645ab7ba247529060589ecac31c948d333d5a.zip
fixed memory leak in parse_rpm.
-rw-r--r--URPM.xs7
1 files changed, 4 insertions, 3 deletions
diff --git a/URPM.xs b/URPM.xs
index fd48248..43d0433 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -3027,9 +3027,10 @@ Urpm_parse_rpm(urpm, filename, ...)
PUTBACK;
memset(&pkg, 0, sizeof(struct s_Package));
pkg.flag = 1 + av_len(depslist);
- sv_pkg = sv_setref_pv(newSVpv("", 0), "URPM::Package",
- _pkg = memcpy(malloc(sizeof(struct s_Package)), &pkg, sizeof(struct s_Package)));
+ _pkg = memcpy(malloc(sizeof(struct s_Package)), &pkg, sizeof(struct s_Package));
+
if (update_header(filename, _pkg, keep_all_tags)) {
+ sv_pkg = sv_setref_pv(newSVpv("", 0), "URPM::Package", _pkg);
if (call_package_callback(urpm, sv_pkg, callback)) {
if (provides) {
update_provides(_pkg, provides);
@@ -3042,7 +3043,7 @@ Urpm_parse_rpm(urpm, filename, ...)
/* only one element read */
XPUSHs(sv_2mortal(newSViv(av_len(depslist))));
XPUSHs(sv_2mortal(newSViv(av_len(depslist))));
- }
+ } else free(_pkg);
} else croak("first argument should contains a depslist ARRAY reference");
} else croak("first argument should be a reference to HASH");