diff options
author | rjray <devnull@localhost> | 2001-05-15 06:22:36 +0000 |
---|---|---|
committer | rjray <devnull@localhost> | 2001-05-15 06:22:36 +0000 |
commit | 00956b95c5177b52c745558b4918f7a231749248 (patch) | |
tree | 4009dea6c0969e4c3434c971733428a254909a5f /Perl-RPM | |
parent | 7ebaafac6a3fa3f9de36ba24718589f2db4b981a (diff) | |
download | librpm-tizen-00956b95c5177b52c745558b4918f7a231749248.tar.gz librpm-tizen-00956b95c5177b52c745558b4918f7a231749248.tar.bz2 librpm-tizen-00956b95c5177b52c745558b4918f7a231749248.zip |
Fixing more of the "attempt to free unreferenced scalar" messages
CVS patchset: 4791
CVS date: 2001/05/15 06:22:36
Diffstat (limited to 'Perl-RPM')
-rw-r--r-- | Perl-RPM/RPM/Database.xs | 12 | ||||
-rw-r--r-- | Perl-RPM/RPM/Header.xs | 27 |
2 files changed, 21 insertions, 18 deletions
diff --git a/Perl-RPM/RPM/Database.xs b/Perl-RPM/RPM/Database.xs index 7f2e9f809..3ad0a4af4 100644 --- a/Perl-RPM/RPM/Database.xs +++ b/Perl-RPM/RPM/Database.xs @@ -5,7 +5,7 @@ #include <fcntl.h> #include "RPM.h" -static char * const rcsid = "$Id: Database.xs,v 1.14 2001/05/12 11:40:27 rjray Exp $"; +static char * const rcsid = "$Id: Database.xs,v 1.15 2001/05/15 06:22:36 rjray Exp $"; /* rpmdb_TIEHASH @@ -189,12 +189,14 @@ SV* rpmdb_FETCH(pTHX_ RPM__Database self, SV* key) FETCHp = rpmhdr_TIEHASH(aTHX_ "RPM::Header", sv_2mortal(newSViv((unsigned)hdr)), RPM_HEADER_FROM_REF | RPM_HEADER_READONLY); + if (name == Null(const char *)) + name = SvPV(rpmhdr_FETCH(aTHX_ FETCHp, + sv_2mortal(newSVpv("NAME", 4)), + Null(const char *), 0, 0), namelen); FETCH = sv_bless(newRV_noinc((SV*)FETCHp), gv_stashpv("RPM::Header", TRUE)); - /* If name is no longer NULL, it means our vector in was a string - (key), so put the result back into the hash-cache. */ - if (name != NULL) - hv_store(dbstruct->storage, (char *)name, namelen, FETCH, FALSE); + hv_store(dbstruct->storage, (char *)name, namelen, newSVsv(FETCH), + FALSE); } #if RPM_MAJOR >= 4 rpmdbFreeIterator(mi); diff --git a/Perl-RPM/RPM/Header.xs b/Perl-RPM/RPM/Header.xs index c5b6e01e1..751fbcf4c 100644 --- a/Perl-RPM/RPM/Header.xs +++ b/Perl-RPM/RPM/Header.xs @@ -14,7 +14,7 @@ # define HDR_ITER_CONST #endif -static char * const rcsid = "$Id: Header.xs,v 1.23 2001/04/29 22:44:54 rjray Exp $"; +static char * const rcsid = "$Id: Header.xs,v 1.24 2001/05/15 06:22:36 rjray Exp $"; static int scalar_tag(pTHX_ SV *, int); /* @@ -206,9 +206,12 @@ static SV* rpmhdr_create(pTHX_ const char* data, int type, int size, } if (scalar) + { new_item = newSVsv(*av_fetch(new_list, 0, FALSE)); + av_undef(new_list); + } else - new_item = newRV((SV *)new_list); + new_item = newRV_noinc((SV *)new_list); return new_item; } @@ -334,7 +337,6 @@ RPM__Header rpmhdr_TIEHASH(pTHX_ char* class, SV* source, int flags) sv_magic((SV *)RETVAL, Nullsv, 'P', Nullch, 0); sv_magic((SV *)RETVAL, t_magic, '~', Nullch, 0); SvREFCNT_dec(t_magic); - /*fprintf(stderr, "rpmhdr_TIEHASH (%s)\n", retvalp->name);*/ return RETVAL; } @@ -393,18 +395,15 @@ SV* rpmhdr_FETCH(pTHX_ RPM__Header self, SV* key, { /* In some cases (particarly the iterators) we could be called with the data already available, but not hashed just yet. */ - SV* new_item = rpmhdr_create(aTHX_ data_in, type_in, size_in, - scalar_tag(aTHX_ Nullsv, tag_by_num)); + FETCH = rpmhdr_create(aTHX_ data_in, type_in, size_in, + scalar_tag(aTHX_ Nullsv, tag_by_num)); - hv_store(hdr->storage, uc_name, namelen, new_item, FALSE); + hv_store(hdr->storage, uc_name, namelen, FETCH, FALSE); hv_store(hdr->storage, strcat(uc_name, "_t"), (namelen + 2), newSViv(type_in), FALSE); - - FETCH = newSVsv(new_item); } else { - SV* new_item; char* new_item_p; int new_item_type; int size; @@ -419,13 +418,15 @@ SV* rpmhdr_FETCH(pTHX_ RPM__Header self, SV* key, Safefree(uc_name); return FETCH; } - new_item = rpmhdr_create(aTHX_ new_item_p, new_item_type, size, - scalar_tag(aTHX_ Nullsv, tag_by_num)); + FETCH = rpmhdr_create(aTHX_ new_item_p, new_item_type, size, + scalar_tag(aTHX_ Nullsv, tag_by_num)); - hv_store(hdr->storage, uc_name, namelen, new_item, FALSE); + hv_store(hdr->storage, uc_name, namelen, FETCH, FALSE); hv_store(hdr->storage, strcat(uc_name, "_t"), (namelen + 2), newSViv(new_item_type), FALSE); - FETCH = newSVsv(new_item); + /* For some reason, I don't seem to need this next line in the + block above (the data_in branch) */ + FETCH = newSVsv(FETCH); } } |