1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dthelp: more coverity fixes

This commit is contained in:
Peter Howkins 2018-04-11 02:07:55 +01:00
parent f4e3cb8327
commit 10468068ac
9 changed files with 14 additions and 7 deletions

View file

@ -192,6 +192,7 @@ int _DtHPrGenFileOrPrint(
if ( (status = system(printCommand))!= 0) if ( (status = system(printCommand))!= 0)
{ {
unlink(tmpfile); unlink(tmpfile);
free(tmpfile);
return status; /* RETURN */ return status; /* RETURN */
} }

View file

@ -1610,6 +1610,7 @@ else
{ {
strcpy(pCharset, charset); strcpy(pCharset, charset);
mb_free(&charset); mb_free(&charset);
free(charset);
} }
else else
strcpy(pCharset, isoString); strcpy(pCharset, isoString);
@ -2809,7 +2810,7 @@ int tryleng = sizeof(pathbuf);
int pathleng; int pathleng;
int fileleng; int fileleng;
SEARCH *thispath; SEARCH *thispath;
char *mb_inputname; char *mb_inputname = NULL;
M_WCHAR *wc_try, *wc_outputname; M_WCHAR *wc_try, *wc_outputname;
int tossfile; int tossfile;
char filebuf[BIGBUF]; char filebuf[BIGBUF];
@ -2876,6 +2877,8 @@ else
} }
if (try != pathbuf) mb_free(&try); if (try != pathbuf) mb_free(&try);
mb_free(&mb_inputname);
} }
/* Below is a modified version of m_cyclent() that returns a pointer /* Below is a modified version of m_cyclent() that returns a pointer

View file

@ -155,6 +155,7 @@ strcpy(helpext, ".xrh");
tex = fopen(helpbase, "w"); tex = fopen(helpbase, "w");
fprintf(tex, "\\gobble\001%s\002%%\n", m_signon); fprintf(tex, "\\gobble\001%s\002%%\n", m_signon);
fputs("% Generated Cross-Reference Macros (for a particular document)\n", tex); fputs("% Generated Cross-Reference Macros (for a particular document)\n", tex);
fclose(tex);
if (! xtree.data) return; if (! xtree.data) return;
n = 0; n = 0;

View file

@ -483,7 +483,7 @@ char *partype(n)
void srefout(M_NOPAR) void srefout(M_NOPAR)
{ {
LOGICAL first = TRUE ; LOGICAL first = TRUE ;
int *mapbysref ; int *mapbysref = NULL;
SREFSTRUCT *srefp ; SREFSTRUCT *srefp ;
SREFDATA *data ; SREFDATA *data ;
int count = 0 ; int count = 0 ;
@ -544,6 +544,7 @@ void srefout(M_NOPAR)
fputs(ndif, dtd) ; fputs(ndif, dtd) ;
} }
SUBONE SUBONE
free(mapbysref);
} }
/* Output one element block in a template */ /* Output one element block in a template */

View file

@ -424,8 +424,9 @@ if (loading) newdlm = (char **) calloc(trysize, sizeof(M_WCHAR *));
if (! newtransit || (loading && ! newdlm)) if (! newtransit || (loading && ! newdlm))
{ {
trysize = NUMDELIM + 1; trysize = NUMDELIM + 1;
free(newtransit);
newtransit = (int *) calloc(NUMCON * trysize, sizeof(int)); 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)) if (! newtransit || (loading && ! newdlm))
{ {

View file

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

View file

@ -75,7 +75,7 @@ int main(argc, argv)
fprintf(stderr, "**** Specify interface file ****\n") ; fprintf(stderr, "**** Specify interface file ****\n") ;
exit(TRUE) ; exit(TRUE) ;
} }
strncpy(iffile, argv[1], IFLEN) ; strncpy(iffile, argv[1], IFLEN - 1) ;
initialize() ; initialize() ;
while (TRUE) { while (TRUE) {
m_token = scan() ; m_token = scan() ;

View file

@ -6395,7 +6395,7 @@ while (incr)
* the amount of padding needed in between the vstruct and the first * the amount of padding needed in between the vstruct and the first
* virpage to make everything work * virpage to make everything work
*/ */
static int CompressVstruct() static void CompressVstruct()
{ {
#define COMPRESS_PAD_LENGTH 10 #define COMPRESS_PAD_LENGTH 10
char buffer[BUFSIZ], zTemp[4]; char buffer[BUFSIZ], zTemp[4];

View file

@ -72,8 +72,7 @@ void entout(fname)
int nameindex ; int nameindex ;
LOGICAL start ; LOGICAL start ;
strncpy(efilename, fname, ENTFILENAME) ; snprintf(efilename, sizeof(efilename), "%s.h", fname);
strncpy(&efilename[strlen(efilename)], ".h", 2) ;
m_openchk(&entfile, efilename, "w") ; m_openchk(&entfile, efilename, "w") ;
fprintf(entfile, "#include \"entdef.h\"\n") ; fprintf(entfile, "#include \"entdef.h\"\n") ;