This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Pointers set but then (immediately or very shortly) overwritten.
authorJarkko Hietaniemi <jhi@iki.fi>
Sat, 26 Apr 2014 01:52:54 +0000 (21:52 -0400)
committerTony Cook <tony@develop-help.com>
Thu, 29 May 2014 06:02:26 +0000 (16:02 +1000)
Fix for Coverity perl5 CIDs 29203, 29207, 29211, 29214, 29217, 29218,
29222: Unused pointer value (UNUSED_VALUE) Pointer foo returned by
bar() is overwritten.

ext/XS-APItest/APItest.xs
perlio.c
toke.c
x2p/a2py.c
x2p/walk.c

index a51924d..f741664 100644 (file)
@@ -1457,10 +1457,10 @@ common(params)
        if ((svp = hv_fetchs(params, "hash", 0)))
            hash = SvUV(*svp);
 
-       if ((svp = hv_fetchs(params, "hash_pv", 0))) {
+       if (hv_fetchs(params, "hash_pv", 0)) {
            PERL_HASH(hash, key, klen);
        }
-       if ((svp = hv_fetchs(params, "hash_sv", 0))) {
+       if (hv_fetchs(params, "hash_sv", 0)) {
            STRLEN len;
            const char *const p = SvPV(keysv, len);
            PERL_HASH(hash, p, len);
index aa9a932..03c6513 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -2948,7 +2948,7 @@ PerlIO_importFILE(FILE *stdio, const char *mode)
            }
            fclose(f2);
        }
-       if ((f = PerlIO_push(aTHX_(f = PerlIO_allocate(aTHX)), PERLIO_FUNCS_CAST(&PerlIO_stdio), mode, NULL))) {
+       if ((f = PerlIO_push(aTHX_(PerlIO_allocate(aTHX)), PERLIO_FUNCS_CAST(&PerlIO_stdio), mode, NULL))) {
            s = PerlIOSelf(f, PerlIOStdio);
            s->stdio = stdio;
            PerlIOUnix_refcnt_inc(fileno(stdio));
@@ -2971,8 +2971,8 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers,
        if (!IS_SAFE_PATHNAME(path, len, "open"))
             return NULL;
        PerlIOUnix_refcnt_dec(fileno(s->stdio));
-       stdio = PerlSIO_freopen(path, (mode = PerlIOStdio_mode(mode, tmode)),
-                           s->stdio);
+       stdio = PerlSIO_freopen(path, PerlIOStdio_mode(mode, tmode),
+                                s->stdio);
        if (!s->stdio)
            return NULL;
        s->stdio = stdio;
diff --git a/toke.c b/toke.c
index a3e9ad5..3f5336a 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -10399,7 +10399,6 @@ S_scan_inputsymbol(pTHX_ char *start)
            Copy("ARGV",d,5,char);
 
        /* Check whether readline() is overriden */
-       gv_readline = gv_fetchpvs("readline", GV_NOTQUAL, SVt_PVCV);
        if ((gv_readline = gv_override("readline",8)))
            readline_overriden = TRUE;
 
index 8c08202..8daee2a 100644 (file)
@@ -70,7 +70,7 @@ main(int argc, const char **argv)
 
     myname = argv[0];
     linestr = str_new(80);
-    str = str_new(0);          /* first used for -I flags */
+    /* first used for -I flags */
     for (argc--,argv++; argc; argc--,argv++) {
        if (argv[0][0] != '-' || !argv[0][1])
            break;
index 0197fea..d6962ed 100644 (file)
@@ -254,7 +254,6 @@ sub Pick {\n\
        break;
     case OHUNK:
        if (len == 1) {
-           str = str_new(0);
            str = walk(0,level,oper1(OPRINT,0),&numarg,P_MIN);
            str_cat(str," if ");
            str_scat(str,fstr=walk(0,level,ops[node+1].ival,&numarg,P_MIN));
@@ -1104,7 +1103,7 @@ sub Pick {\n\
        if (!do_fancy_opens) {
            t = tmpstr->str_ptr;
            if (*t == '"' || *t == '\'')
-               t = cpytill(tokenbuf,t+1,*t);
+               cpytill(tokenbuf,t+1,*t);
            else
                fatal("Internal error: OCLOSE %s",t);
            s = savestr(tokenbuf);