dthelp: coverity fixes

This commit is contained in:
Peter Howkins
2018-04-13 20:26:23 +01:00
parent fee6003be1
commit 9b4b82c1f0
13 changed files with 53 additions and 58 deletions

View File

@@ -544,6 +544,8 @@ void srefout(M_NOPAR)
fputs(ndif, dtd) ;
}
SUBONE
free(mapbysref);
}
/* Output one element block in a template */

View File

@@ -681,11 +681,11 @@ static char ident6[]="@(#) (c) Copyright 1993, 1994 Unix System Labs, Inc., a su
thisnodelevel = 2;
sprintf(id, "%s%s", sdlReservedName, glossary_string);
mb_starthelpnode("_GLOSSARY", id, thisnodelevel);
strcpy(chapstring, string) ;
if (strlen(chapstring) + 1 > sizeof(chapstring)) {
if (strlen(string) + 1 > sizeof(chapstring)) {
m_error("Program error: exceeded chapstring") ;
m_exit(TRUE) ;
}
sprintf(chapstring, sizeof(chapstring), "%s", string) ;
fputs("\nGlossary\n", stderr) ;
glossary = TRUE ;
fprintf(outfile, "<HEAD SSI=\"CHAPHEAD\">%s</HEAD>\n", string);

View File

@@ -424,8 +424,13 @@ if (loading) newdlm = (char **) calloc(trysize, sizeof(M_WCHAR *));
if (! newtransit || (loading && ! newdlm))
{
trysize = NUMDELIM + 1;
free(newtransit);
newtransit = (int *) calloc(NUMCON * trysize, sizeof(int));
if (loading) newdlm = (char **) calloc(trysize, sizeof(M_WCHAR *));
if (loading)
{
free(newdlm);
newdlm = (char **) calloc(trysize, sizeof(M_WCHAR *));
}
}
if (! newtransit || (loading && ! newdlm))
{

View File

@@ -144,6 +144,7 @@ void copyfile(pfile1,pfile2)
ret = system(pcmd);
ret = snprintf(pcmd, slen, "touch %s",pfile2);
ret = system(pcmd);
free(pcmd);
}
int nextchar(file, data)