Coverity-updates archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

New Defects reported by Coverity Scan for NetBSD-amd64-kernel



Hi,

Please find the latest report on new defect(s) introduced to NetBSD-amd64-kernel found with Coverity Scan.

39 new defect(s) introduced to NetBSD-amd64-kernel found with Coverity Scan.
1127 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 20 of 39 defect(s)


** CID 270538:    (NULL_RETURNS)
/usr.bin/make/suff.c: 1909 in SuffFindArchiveDeps()
/usr.bin/make/suff.c: 1909 in SuffFindArchiveDeps()
/usr.bin/make/suff.c: 1911 in SuffFindArchiveDeps()


________________________________________________________________________________________________________
*** CID 270538:    (NULL_RETURNS)
/usr.bin/make/suff.c: 1909 in SuffFindArchiveDeps()
1903     
1904         /*
1905          * The node is an archive(member) pair. so we must find a
1906          * suffix for both of them.
1907          */
1908         eoarch = strchr(gn->name, '(');
>>>     CID 270538:    (NULL_RETURNS)
>>>     Dereferencing a pointer that might be null "eoarch" when calling "strchr".
1909         eoname = strchr(eoarch, ')');
1910     
1911         *eoname = '\0';	  /* Nuke parentheses during suffix search */
1912         *eoarch = '\0';	  /* So a suffix can be found */
1913     
1914         name = eoarch + 1;
/usr.bin/make/suff.c: 1909 in SuffFindArchiveDeps()
1903     
1904         /*
1905          * The node is an archive(member) pair. so we must find a
1906          * suffix for both of them.
1907          */
1908         eoarch = strchr(gn->name, '(');
>>>     CID 270538:    (NULL_RETURNS)
>>>     Dereferencing a pointer that might be null "eoarch" when calling "strchr".
1909         eoname = strchr(eoarch, ')');
1910     
1911         *eoname = '\0';	  /* Nuke parentheses during suffix search */
1912         *eoarch = '\0';	  /* So a suffix can be found */
1913     
1914         name = eoarch + 1;
/usr.bin/make/suff.c: 1911 in SuffFindArchiveDeps()
1905          * The node is an archive(member) pair. so we must find a
1906          * suffix for both of them.
1907          */
1908         eoarch = strchr(gn->name, '(');
1909         eoname = strchr(eoarch, ')');
1910     
>>>     CID 270538:    (NULL_RETURNS)
>>>     Dereferencing a null pointer "eoname".
1911         *eoname = '\0';	  /* Nuke parentheses during suffix search */
1912         *eoarch = '\0';	  /* So a suffix can be found */
1913     
1914         name = eoarch + 1;
1915     
1916         /*

** CID 974621:  Memory - corruptions  (BAD_FREE)
/usr.bin/make/var.c: 3677 in ApplyModifiers()


________________________________________________________________________________________________________
*** CID 974621:  Memory - corruptions  (BAD_FREE)
/usr.bin/make/var.c: 3677 in ApplyModifiers()
3671     	    fprintf(debug_file, "Result[%s] of :%c is \"%s\"\n",
3672     		v->name, modifier, newStr);
3673     	}
3674     
3675     	if (newStr != nstr) {
3676     	    if (*freePtr) {
>>>     CID 974621:  Memory - corruptions  (BAD_FREE)
>>>     "free" frees incorrect pointer "nstr".
3677     		free(nstr);
3678     		*freePtr = NULL;
3679     	    }
3680     	    nstr = newStr;
3681     	    if (nstr != var_Error && nstr != varNoError) {
3682     		*freePtr = nstr;

** CID 975275:    (CHECKED_RETURN)
/usr.bin/make/arch.c: 912 in ArchFindMember()
/usr.bin/make/arch.c: 942 in ArchFindMember()
/usr.bin/make/arch.c: 945 in ArchFindMember()
/usr.bin/make/arch.c: 960 in ArchFindMember()


________________________________________________________________________________________________________
*** CID 975275:    (CHECKED_RETURN)
/usr.bin/make/arch.c: 912 in ArchFindMember()
906     		 * To make life easier, we reposition the file at the start
907     		 * of the header we just read before we return the stream.
908     		 * In a more general situation, it might be better to leave
909     		 * the file at the actual member, rather than its header, but
910     		 * not here...
911     		 */
>>>     CID 975275:    (CHECKED_RETURN)
>>>     Calling "fseek(arch, -60L, 1)" without checking return value. This library function may fail and return an error code.
912     		fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR);
913     		return (arch);
914     	    }
915     	} else
916     #ifdef AR_EFMT1
917     		/*
/usr.bin/make/arch.c: 942 in ArchFindMember()
936     		ename[elen] = '\0';
937     		if (DEBUG(ARCH) || DEBUG(MAKE)) {
938     		    fprintf(debug_file, "ArchFind: Extended format entry for %s\n", ename);
939     		}
940     		if (strncmp(ename, member, len) == 0) {
941     			/* Found as extended name */
>>>     CID 975275:    (CHECKED_RETURN)
>>>     Calling "fseek(arch, 4294967236U - elen, 1)" without checking return value. This library function may fail and return an error code.
942     			fseek(arch, -sizeof(struct ar_hdr) - elen, SEEK_CUR);
943     			return (arch);
944     		}
945     		fseek(arch, -elen, SEEK_CUR);
946     		goto skip;
947     	} else
/usr.bin/make/arch.c: 945 in ArchFindMember()
939     		}
940     		if (strncmp(ename, member, len) == 0) {
941     			/* Found as extended name */
942     			fseek(arch, -sizeof(struct ar_hdr) - elen, SEEK_CUR);
943     			return (arch);
944     		}
>>>     CID 975275:    (CHECKED_RETURN)
>>>     Calling "fseek(arch, -elen, 1)" without checking return value. This library function may fail and return an error code.
945     		fseek(arch, -elen, SEEK_CUR);
946     		goto skip;
947     	} else
948     #endif
949     	{
950     skip:
/usr.bin/make/arch.c: 960 in ArchFindMember()
954     	     * padded with newlines to an even-byte boundary, so we need to
955     	     * extract the size of the file from the 'size' field of the
956     	     * header and round it up during the seek.
957     	     */
958     	    arhPtr->ar_size[sizeof(arhPtr->ar_size)-1] = '\0';
959     	    size = (int)strtol(arhPtr->ar_size, NULL, 10);
>>>     CID 975275:    (CHECKED_RETURN)
>>>     Calling "fseek(arch, size + 1 & 0xfffffffffffffffe, 1)" without checking return value. This library function may fail and return an error code.
960     	    fseek(arch, (size + 1) & ~1, SEEK_CUR);
961     	}
962         }
963     
964         /*
965          * We've looked everywhere, but the member is not to be found. Close the

** CID 975276:    (CHECKED_RETURN)
/usr.bin/make/arch.c: 682 in ArchStatMember()
/usr.bin/make/arch.c: 693 in ArchStatMember()


________________________________________________________________________________________________________
*** CID 975276:    (CHECKED_RETURN)
/usr.bin/make/arch.c: 682 in ArchStatMember()
676     
677     		if (elen > MAXPATHLEN)
678     			goto badarch;
679     		if (fread(memName, elen, 1, arch) != 1)
680     			goto badarch;
681     		memName[elen] = '\0';
>>>     CID 975276:    (CHECKED_RETURN)
>>>     Calling "fseek(arch, -elen, 1)" without checking return value. This library function may fail and return an error code.
682     		fseek(arch, -elen, SEEK_CUR);
683     		if (DEBUG(ARCH) || DEBUG(MAKE)) {
684     		    fprintf(debug_file, "ArchStat: Extended format entry for %s\n", memName);
685     		}
686     	    }
687     #endif
/usr.bin/make/arch.c: 693 in ArchStatMember()
687     #endif
688     
689     	    he = Hash_CreateEntry(&ar->members, memName, NULL);
690     	    Hash_SetValue(he, bmake_malloc(sizeof(struct ar_hdr)));
691     	    memcpy(Hash_GetValue(he), &arh, sizeof(struct ar_hdr));
692     	}
>>>     CID 975276:    (CHECKED_RETURN)
>>>     Calling "fseek(arch, size + 1 & 0xfffffffffffffffe, 1)" without checking return value. This library function may fail and return an error code.
693     	fseek(arch, (size + 1) & ~1, SEEK_CUR);
694         }
695     
696         fclose(arch);
697     
698         (void)Lst_AtEnd(archives, ar);

** CID 975277:  Error handling issues  (CHECKED_RETURN)
/usr.bin/make/job.c: 438 in JobCreatePipe()


________________________________________________________________________________________________________
*** CID 975277:  Error handling issues  (CHECKED_RETURN)
/usr.bin/make/job.c: 438 in JobCreatePipe()
432         /*
433          * We mark the input side of the pipe non-blocking; we poll(2) the
434          * pipe when we're waiting for a job token, but we might lose the
435          * race for the token when a new one becomes available, so the read 
436          * from the pipe should not block.
437          */
>>>     CID 975277:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "fcntl(job->jobPipe[0], 4, fcntl(job->jobPipe[0], 3, 0) | 4)" without checking return value. This library function may fail and return an error code.
438         fcntl(job->jobPipe[0], F_SETFL, 
439     	fcntl(job->jobPipe[0], F_GETFL, 0) | O_NONBLOCK);
440     }
441     
442     /*-
443      *-----------------------------------------------------------------------

** CID 975278:    (CHECKED_RETURN)
/usr.bin/make/job.c: 1375 in JobExec()
/usr.bin/make/job.c: 1376 in JobExec()


________________________________________________________________________________________________________
*** CID 975278:    (CHECKED_RETURN)
/usr.bin/make/job.c: 1375 in JobExec()
1369     	(void)lseek(0, (off_t)0, SEEK_SET);
1370     
1371     	if (job->node->type & (OP_MAKE | OP_SUBMAKE)) {
1372     		/*
1373     		 * Pass job token pipe to submakes.
1374     		 */
>>>     CID 975278:    (CHECKED_RETURN)
>>>     Calling "fcntl(tokenWaitJob.jobPipe[0], 2, 0)" without checking return value. This library function may fail and return an error code.
1375     		fcntl(tokenWaitJob.inPipe, F_SETFD, 0);
1376     		fcntl(tokenWaitJob.outPipe, F_SETFD, 0);		
1377     	}
1378     	
1379     	/*
1380     	 * Set up the child's output to be routed through the pipe
/usr.bin/make/job.c: 1376 in JobExec()
1370     
1371     	if (job->node->type & (OP_MAKE | OP_SUBMAKE)) {
1372     		/*
1373     		 * Pass job token pipe to submakes.
1374     		 */
1375     		fcntl(tokenWaitJob.inPipe, F_SETFD, 0);
>>>     CID 975278:    (CHECKED_RETURN)
>>>     Calling "fcntl(tokenWaitJob.jobPipe[1], 2, 0)" without checking return value. This library function may fail and return an error code.
1376     		fcntl(tokenWaitJob.outPipe, F_SETFD, 0);		
1377     	}
1378     	
1379     	/*
1380     	 * Set up the child's output to be routed through the pipe
1381     	 * we've created for it.

** CID 975995:  Control flow issues  (DEADCODE)
/usr.bin/make/cond.c: 1178 in Cond_EvalExpression()


________________________________________________________________________________________________________
*** CID 975995:  Control flow issues  (DEADCODE)
/usr.bin/make/cond.c: 1178 in Cond_EvalExpression()
1172     	for (info = ifs; ; info++)
1173     	    if (info->form[0] == 0)
1174     		break;
1175     	dflt_info = info;
1176         }
1177     
>>>     CID 975995:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach the expression "&ifs[4]" inside this statement: "if_info = ((info != NULL) ?...".
1178         if_info = info != NULL ? info : ifs + 4;
1179         condExpr = line;
1180         condPushBack = TOK_NONE;
1181     
1182         rval = do_Cond_EvalExpression(value);
1183     

** CID 977428:  Memory - illegal accesses  (OVERRUN)
/usr.bin/make/parse.c: 554 in loadfile()


________________________________________________________________________________________________________
*** CID 977428:  Memory - illegal accesses  (OVERRUN)
/usr.bin/make/parse.c: 554 in loadfile()
548     	while (1) {
549     		assert(bufpos <= lf->len);
550     		if (bufpos == lf->len) {
551     			lf->len *= 2;
552     			lf->buf = bmake_realloc(lf->buf, lf->len);
553     		}
>>>     CID 977428:  Memory - illegal accesses  (OVERRUN)
>>>     Overrunning dynamic array "lf->buf" at offset corresponding to index variable "bufpos" through dereference in call to "read".
554     		result = read(fd, lf->buf + bufpos, lf->len - bufpos);
555     		if (result < 0) {
556     			Error("%s: read error: %s", path, strerror(errno));
557     			exit(1);
558     		}
559     		if (result == 0) {

** CID 977502:  Incorrect expression  (PW.ASSIGN_WHERE_COMPARE_MEANT)
/usr.bin/make/for.c: 430 in ()


________________________________________________________________________________________________________
*** CID 977502:  Incorrect expression  (PW.ASSIGN_WHERE_COMPARE_MEANT)
/usr.bin/make/for.c: 430 in ()
424         cmd_cp = Buf_GetAll(&arg->buf, &len);
425         body_end = cmd_cp + len;
426         Buf_Init(&cmds, len + 256);
427         for (cp = cmd_cp; (cp = strchr(cp, '$')) != NULL;) {
428     	char ech;
429     	ch = *++cp;
>>>     CID 977502:  Incorrect expression  (PW.ASSIGN_WHERE_COMPARE_MEANT)
>>>     use of "=" where "==" may have been intended
430     	if ((ch == '(' && (ech = ')')) || (ch == '{' && (ech = '}'))) {
431     	    cp++;
432     	    /* Check variable name against the .for loop variables */
433     	    STRLIST_FOREACH(var, &arg->vars, i) {
434     		len = strlist_info(&arg->vars, i);
435     		if (memcmp(cp, var, len) != 0)

** CID 977503:  Incorrect expression  (PW.ASSIGN_WHERE_COMPARE_MEANT)
/usr.bin/make/for.c: 430 in ()


________________________________________________________________________________________________________
*** CID 977503:  Incorrect expression  (PW.ASSIGN_WHERE_COMPARE_MEANT)
/usr.bin/make/for.c: 430 in ()
424         cmd_cp = Buf_GetAll(&arg->buf, &len);
425         body_end = cmd_cp + len;
426         Buf_Init(&cmds, len + 256);
427         for (cp = cmd_cp; (cp = strchr(cp, '$')) != NULL;) {
428     	char ech;
429     	ch = *++cp;
>>>     CID 977503:  Incorrect expression  (PW.ASSIGN_WHERE_COMPARE_MEANT)
>>>     use of "=" where "==" may have been intended
430     	if ((ch == '(' && (ech = ')')) || (ch == '{' && (ech = '}'))) {
431     	    cp++;
432     	    /* Check variable name against the .for loop variables */
433     	    STRLIST_FOREACH(var, &arg->vars, i) {
434     		len = strlist_info(&arg->vars, i);
435     		if (memcmp(cp, var, len) != 0)

** CID 978364:  Resource leaks  (RESOURCE_LEAK)
/usr.bin/make/dir.c: 1319 in Dir_FindFile()


________________________________________________________________________________________________________
*** CID 978364:  Resource leaks  (RESOURCE_LEAK)
/usr.bin/make/dir.c: 1319 in Dir_FindFile()
1313     	 */
1314     	if (DEBUG(DIR)) {
1315     	    fprintf(debug_file, "   Trying exact path matches...\n");
1316     	}
1317     
1318     	if (!hasLastDot && cur && (file = DirLookupAbs(cur, name, cp)) != NULL)
>>>     CID 978364:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "file" going out of scope leaks the storage it points to.
1319     	    return *file?file:NULL;
1320     
1321     	(void)Lst_Open(path);
1322     	while ((ln = Lst_Next(path)) != NULL) {
1323     	    p = (Path *)Lst_Datum(ln);
1324     	    if (p == dotLast)

** CID 978365:  Resource leaks  (RESOURCE_LEAK)
/usr.bin/make/dir.c: 1581 in Dir_MTime()


________________________________________________________________________________________________________
*** CID 978365:  Resource leaks  (RESOURCE_LEAK)
/usr.bin/make/dir.c: 1581 in Dir_MTime()
1575     
1576         if (fullName && gn->path == NULL) {
1577     	gn->path = fullName;
1578         }
1579     
1580         gn->mtime = stb.st_mtime;
>>>     CID 978365:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "fullName" going out of scope leaks the storage it points to.
1581         return (gn->mtime);
1582     }
1583     
1584     /*-
1585      *-----------------------------------------------------------------------
1586      * Dir_AddDir --

** CID 978366:  Resource leaks  (RESOURCE_LEAK)
/usr.bin/make/job.c: 741 in JobPrintCommand()


________________________________________________________________________________________________________
*** CID 978366:  Resource leaks  (RESOURCE_LEAK)
/usr.bin/make/job.c: 741 in JobPrintCommand()
735     	    if (noSpecials) {
736     		/*
737     		 * We're not actually executing anything...
738     		 * but this one needs to be - use compat mode just for it.
739     		 */
740     		CompatRunCommand(cmdp, job->node);
>>>     CID 978366:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "cmdStart" going out of scope leaks the storage it points to.
741     		return 0;
742     	    }
743     	    break;
744     	}
745     	cmd++;
746         }

** CID 978367:    (RESOURCE_LEAK)
/usr.bin/make/lst.lib/lstDupl.c: 93 in Lst_Duplicate()
/usr.bin/make/lst.lib/lstDupl.c: 96 in Lst_Duplicate()


________________________________________________________________________________________________________
*** CID 978367:    (RESOURCE_LEAK)
/usr.bin/make/lst.lib/lstDupl.c: 93 in Lst_Duplicate()
87         }
88     
89         ln = list->firstPtr;
90         while (ln != NULL) {
91     	if (copyProc != NULL) {
92     	    if (Lst_AtEnd(nl, copyProc(ln->datum)) == FAILURE) {
>>>     CID 978367:    (RESOURCE_LEAK)
>>>     Variable "nl" going out of scope leaks the storage it points to.
93     		return NULL;
94     	    }
95     	} else if (Lst_AtEnd(nl, ln->datum) == FAILURE) {
96     	    return NULL;
97     	}
98     
/usr.bin/make/lst.lib/lstDupl.c: 96 in Lst_Duplicate()
90         while (ln != NULL) {
91     	if (copyProc != NULL) {
92     	    if (Lst_AtEnd(nl, copyProc(ln->datum)) == FAILURE) {
93     		return NULL;
94     	    }
95     	} else if (Lst_AtEnd(nl, ln->datum) == FAILURE) {
>>>     CID 978367:    (RESOURCE_LEAK)
>>>     Variable "nl" going out of scope leaks the storage it points to.
96     	    return NULL;
97     	}
98     
99     	if (list->isCirc && ln == list->lastPtr) {
100     	    ln = NULL;
101     	} else {

** CID 978369:    (RESOURCE_LEAK)
/usr.bin/make/parse.c: 1738 in ParseDoDependency()
/usr.bin/make/parse.c: 1738 in ParseDoDependency()


________________________________________________________________________________________________________
*** CID 978369:    (RESOURCE_LEAK)
/usr.bin/make/parse.c: 1738 in ParseDoDependency()
1732     	Lst_ForEach(targets, ParseFindMain, NULL);
1733         }
1734     
1735     out:
1736         if (curTargs)
1737     	    Lst_Destroy(curTargs, NULL);
>>>     CID 978369:    (RESOURCE_LEAK)
>>>     Variable "paths" going out of scope leaks the storage it points to.
1738     }
1739     
1740     /*-
1741      *---------------------------------------------------------------------
1742      * Parse_IsVar  --
1743      *	Return TRUE if the passed line is a variable assignment. A variable
/usr.bin/make/parse.c: 1738 in ParseDoDependency()
1732     	Lst_ForEach(targets, ParseFindMain, NULL);
1733         }
1734     
1735     out:
1736         if (curTargs)
1737     	    Lst_Destroy(curTargs, NULL);
>>>     CID 978369:    (RESOURCE_LEAK)
>>>     Variable "paths" going out of scope leaks the storage it points to.
1738     }
1739     
1740     /*-
1741      *---------------------------------------------------------------------
1742      * Parse_IsVar  --
1743      *	Return TRUE if the passed line is a variable assignment. A variable

** CID 978370:  Resource leaks  (RESOURCE_LEAK)
/usr.bin/make/parse.c: 2604 in ParseGmakeExport()


________________________________________________________________________________________________________
*** CID 978370:  Resource leaks  (RESOURCE_LEAK)
/usr.bin/make/parse.c: 2604 in ParseGmakeExport()
2598     
2599         /*
2600          * Expand the value before putting it in the environment.
2601          */
2602         value = Var_Subst(NULL, value, VAR_CMD, VARF_WANTRES);
2603         setenv(variable, value, 1);
>>>     CID 978370:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "value" going out of scope leaks the storage it points to.
2604     }
2605     #endif
2606     
2607     /*-
2608      *---------------------------------------------------------------------
2609      * ParseEOF  --

** CID 978371:  Resource leaks  (RESOURCE_LEAK)
/usr.bin/make/parse.c: 2539 in ParseTraditionalInclude()


________________________________________________________________________________________________________
*** CID 978371:  Resource leaks  (RESOURCE_LEAK)
/usr.bin/make/parse.c: 2539 in ParseTraditionalInclude()
2533          */
2534         all_files = Var_Subst(NULL, file, VAR_CMD, VARF_WANTRES);
2535     
2536         if (*file == '\0') {
2537     	Parse_Error(PARSE_FATAL,
2538     		     "Filename missing from \"include\"");
>>>     CID 978371:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "all_files" going out of scope leaks the storage it points to.
2539     	return;
2540         }
2541     
2542         for (file = all_files; !done; file = cp + 1) {
2543     	/* Skip to end of line or next whitespace */
2544     	for (cp = file; *cp && !isspace((unsigned char) *cp); cp++)

** CID 978372:  Resource leaks  (RESOURCE_LEAK)
/usr.bin/make/var.c: 1843 in VarLoopExpand()


________________________________________________________________________________________________________
*** CID 978372:  Resource leaks  (RESOURCE_LEAK)
/usr.bin/make/var.c: 1843 in VarLoopExpand()
1837                     Buf_AddByte(buf, ' ');
1838                 Buf_AddBytes(buf, (slen = strlen(s)), s);
1839                 addSpace = (slen > 0 && s[slen - 1] != '\n');
1840                 free(s);
1841             }
1842         }
>>>     CID 978372:  Resource leaks  (RESOURCE_LEAK)
>>>     Variable "s" going out of scope leaks the storage it points to.
1843         return addSpace;
1844     }
1845     
1846     
1847     /*-
1848      *-----------------------------------------------------------------------

** CID 978373:    (RESOURCE_LEAK)
/usr.bin/make/var.c: 629 in Var_Export1()
/usr.bin/make/var.c: 640 in Var_Export1()
/usr.bin/make/var.c: 647 in Var_Export1()
/usr.bin/make/var.c: 669 in Var_Export1()


________________________________________________________________________________________________________
*** CID 978373:    (RESOURCE_LEAK)
/usr.bin/make/var.c: 629 in Var_Export1()
623         v = VarFind(name, VAR_GLOBAL, 0);
624         if (v == NULL) {
625     	return 0;
626         }
627         if (!parent &&
628     	(v->flags & (VAR_EXPORTED|VAR_REEXPORT)) == VAR_EXPORTED) {
>>>     CID 978373:    (RESOURCE_LEAK)
>>>     Variable "v" going out of scope leaks the storage it points to.
629     	return 0;			/* nothing to do */
630         }
631         val = Buf_GetAll(&v->val, NULL);
632         if ((flags & VAR_EXPORT_LITERAL) == 0 && strchr(val, '$')) {
633     	if (parent) {
634     	    /*
/usr.bin/make/var.c: 640 in Var_Export1()
634     	    /*
635     	     * Flag this as something we need to re-export.
636     	     * No point actually exporting it now though,
637     	     * the child can do it at the last minute.
638     	     */
639     	    v->flags |= (VAR_EXPORTED|VAR_REEXPORT);
>>>     CID 978373:    (RESOURCE_LEAK)
>>>     Variable "v" going out of scope leaks the storage it points to.
640     	    return 1;
641     	}
642     	if (v->flags & VAR_IN_USE) {
643     	    /*
644     	     * We recursed while exporting in a child.
645     	     * This isn't going to end well, just skip it.
/usr.bin/make/var.c: 647 in Var_Export1()
641     	}
642     	if (v->flags & VAR_IN_USE) {
643     	    /*
644     	     * We recursed while exporting in a child.
645     	     * This isn't going to end well, just skip it.
646     	     */
>>>     CID 978373:    (RESOURCE_LEAK)
>>>     Variable "v" going out of scope leaks the storage it points to.
647     	    return 0;
648     	}
649     	n = snprintf(tmp, sizeof(tmp), "${%s}", name);
650     	if (n < (int)sizeof(tmp)) {
651     	    val = Var_Subst(NULL, tmp, VAR_GLOBAL, VARF_WANTRES);
652     	    setenv(name, val, 1);
/usr.bin/make/var.c: 669 in Var_Export1()
663         /*
664          * This is so Var_Set knows to call Var_Export again...
665          */
666         if (parent) {
667     	v->flags |= VAR_EXPORTED;
668         }
>>>     CID 978373:    (RESOURCE_LEAK)
>>>     Variable "v" going out of scope leaks the storage it points to.
669         return 1;
670     }
671     
672     /*
673      * This gets called from our children.
674      */

** CID 978374:    (RESOURCE_LEAK)
/usr.bin/make/var.c: 864 in Var_UnExport()
/usr.bin/make/var.c: 894 in Var_UnExport()


________________________________________________________________________________________________________
*** CID 978374:    (RESOURCE_LEAK)
/usr.bin/make/var.c: 864 in Var_UnExport()
858     	char *as;
859     	int ac;
860     	int i;
861     
862     	av = brk_string(vlist, &ac, FALSE, &as);
863     	for (i = 0; i < ac; i++) {
>>>     CID 978374:    (RESOURCE_LEAK)
>>>     Overwriting "v" in "v = VarFind(av[i], VAR_GLOBAL, 0)" leaks the storage that "v" points to.
864     	    v = VarFind(av[i], VAR_GLOBAL, 0);
865     	    if (!v)
866     		continue;
867     	    if (!unexport_env &&
868     		(v->flags & (VAR_EXPORTED|VAR_REEXPORT)) == VAR_EXPORTED) {
869     		unsetenv(v->name);
/usr.bin/make/var.c: 894 in Var_UnExport()
888     	free(as);
889     	free(av);
890     	if (vlist != str) {
891     	    Var_Delete(MAKE_EXPORTED, VAR_GLOBAL);
892     	    free(vlist);
893     	}
>>>     CID 978374:    (RESOURCE_LEAK)
>>>     Variable "v" going out of scope leaks the storage it points to.
894         }
895     }
896     
897     /*-
898      *-----------------------------------------------------------------------
899      * Var_Set --


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRb2JZfDAOAZcqzsy8LMBKBj0qtSICo2DZNjmmsVjYof54PahgUQ7xLRwU5wjlAON3Q-3D_XWm3CUIFU8ffmjzuNhQ8cIHoQgXzXkm61Fmjr59D05Urrg9cATN9FMzbH4UAMslidW4d8GF6gfXqpINd1KrhrY0YQUdT5-2Fm13fz5CpgC6NANk-2FncOhKJLe5FmXCcmWRX-2FBCK5BzZRPhrWH30f7S1sDjB-2FwT2hObMuprzGuHIstq5H5oD0vRswDSB5qIixYzEaJj12lq9usvRCYSMddlSO1VCTNF4zmlDAkazkRZaVNs-3D

To manage Coverity Scan email notifications for "coverity-updates%netbsd.org@localhost", click https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRbVDbis712qZDP-2FA8y06Nq4m7U7Yoel-2F6MYPxol7ToiLwYIjoNbVQOCAwEeTNJofEDwTlN0JRhKMyijhpnAObR-2FlLVG-2Fr3EBKWgiICNdX1HPA6Ws0-2F1wHBf2tG9AnMDB8g-3D_XWm3CUIFU8ffmjzuNhQ8cIHoQgXzXkm61Fmjr59D05Urrg9cATN9FMzbH4UAMslidW4d8GF6gfXqpINd1KrhreM6cp8-2F5t3KKgswk4WSYDjLXYXHAJGiOUlbNX-2FfnYtLrk172asBiAzBcewviZAl9r6GlHUd9bT5hcgnp29wYQ8CvyvzkZ8fezlCU-2F86yXvAfzJeizSfBY5BLS8AWvIeOf-2FBkLwtBgX-2BPiCb-2FDSkGeE-3D



Home | Main Index | Thread Index | Old Index