dthelp: Further coverity fixes

This commit is contained in:
Peter Howkins
2018-04-30 04:11:44 +01:00
parent c936a8c065
commit 48b97a4c41
15 changed files with 76 additions and 55 deletions

View File

@@ -210,7 +210,11 @@ SEARCH *searchp;
char *mb_entcontent;
mb_entcontent = MakeMByteString(entcontent);
if (!*mb_entcontent) return NULL; /* null file name, don't open a directory */
if (!*mb_entcontent) /* null file name, don't open a directory */
{
m_free(mb_entcontent, "multi-byte string");
return NULL;
}
open = fopen(mb_entcontent, "r");
if (open)
@@ -301,7 +305,9 @@ void m_signmsg(p)
if (q = strstr(p, VERSION)) {
pCopy = strdup(p);
q = strstr(pCopy, VERSION);
*q = M_EOS;
if(q) {
*q = M_EOS;
}
m_errline(pCopy);
free(pCopy);
return;

View File

@@ -870,9 +870,10 @@ static char ident6[]="@(#) (c) Copyright 1993, 1994 Unix System Labs, Inc., a su
{
char *mb_content, snb_id[32];
char buffer[BIGBUF];
static M_WCHAR empty = M_EOS;
static M_WCHAR empty[1];
empty[0] = M_EOS;
if (!f_content) f_content = ∅
if (!f_content) f_content = empty;
mb_content = MakeMByteString(f_content);
sprintf(snb_id, "%s%d", sdlReservedName, NextId());

View File

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

View File

@@ -93,7 +93,6 @@ void m_free(block, msg)
#if defined(MSDOS)
if (m_heapchk) m_heapdump() ;
#endif
free(block) ;
if (m_malftrace) {
#if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__)
snprintf(buffer, 32, "%5x:%5x",
@@ -107,6 +106,7 @@ void m_free(block, msg)
m_trace(msg) ;
m_trace("\n") ;
}
free(block) ;
#if defined(MSDOS)
if (m_heapchk) m_heapdump() ;
#endif