diff options
author | Francois Pons <fpons@mandriva.com> | 2003-06-05 18:41:50 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2003-06-05 18:41:50 +0000 |
commit | 707645ab7ba247529060589ecac31c948d333d5a (patch) | |
tree | 343649369a225cc5e18e39636eb3daebdce64f83 /URPM.xs | |
parent | 2a0f3bc6f665051cd809d328d4b037c8d2b9ac6d (diff) | |
download | perl-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.
Diffstat (limited to 'URPM.xs')
-rw-r--r-- | URPM.xs | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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"); |