lidtsvc: coverity fixes

This commit is contained in:
Peter Howkins
2018-04-12 01:38:02 +01:00
parent 91bb9a037a
commit 691dffb076
17 changed files with 52 additions and 20 deletions

View File

@@ -1598,6 +1598,7 @@ CreateInvocationRecord(
SET_INV_ERROR(invp->state);
SET_INV_CANCEL(invp->state);
close(fd);
return invp;
}

View File

@@ -446,7 +446,7 @@ _DtActValidateFieldValue( long bit, char *value, char *actName, char *filename)
val, _DtACTION_ARG_MODE);
_DtSimpleError(DtProgName,DtError, NULL, "%s", buf);
free(val);
buf = malloc(_DtAct_MAX_BUF_SIZE);
free(buf);
return NULL;
}
break; /* valid value */
@@ -1027,7 +1027,7 @@ _DtActionConverter(DtDtsDbField * fields,
sprintf (buf, missingName, _DtACTION_NAME, fileName);
_DtSimpleError(DtProgName,DtError, NULL, "%s", buf);
XtFree(fileName);
if (buf) XtFree(buf);
XtFree(buf);
_DtSvcProcessUnlock();
return(True);
}

View File

@@ -1393,7 +1393,7 @@ static void
_DtActMMGetTtMsgInfo(DtDtsMMRecord *actRecp, ActionPtr actp)
{
char argNname[ sizeof(_DtACTION_TTN_ARG) /* space for prefix */
+ 3 /* enough space for three decimal digits */
+ 9 /* enough space for three decimal digits */
+ sizeof(_DtACTION_TTN_REP_TYPE)]; /* space for longest suffix */
int i;
char *s;
@@ -2165,6 +2165,7 @@ _DtActionFindDBEntry( ActionRequest *reqp,
if ( reqp )
SET_TOO_MANY_MAPS(reqp->mask);
_DtSvcProcessUnlock();
free(mapto);
return NULL;
}
}

View File

@@ -484,6 +484,7 @@ dndFileContentsToSelectionValue(
buf = (void *)XtMalloc(bufLen + 1);
bytesRead = read(fd, buf, bufLen);
close(fd);
if (bytesRead == -1 || bytesRead != bufLen) {
XtFree((char *)buf);

View File

@@ -155,7 +155,8 @@ extern int cde_da_compare(DtDtsMMRecord **entry1, DtDtsMMRecord **entry2);
extern int cde_dc_field_compare(DtDtsMMField **entry1, DtDtsMMField **entry2);
_DtDtsClear()
void
_DtDtsClear(void)
{
_DtSvcProcessLock();
dtdts_path_pattern = 0;

View File

@@ -69,6 +69,7 @@ typedef int (*genfunc)(const void *, const void *);
static DtDtsDbDatabase **db_list;
static int num_db = 0;
void
_DtDtsDbPrintFields(DtDtsDbRecord *rec_ptr, FILE *fd)
{
int fld;
@@ -84,6 +85,7 @@ _DtDtsDbPrintFields(DtDtsDbRecord *rec_ptr, FILE *fd)
}
}
void
_DtDtsDbPrintRecords(DtDtsDbDatabase *db_ptr, FILE *fd)
{
int rec;

View File

@@ -691,6 +691,7 @@ write_db(DtDtsMMHeader *header, void *index, int size, const char *CacheFile)
_DtSimpleError(
DtProgName, DtError, NULL,
(char*) tmpfile, NULL);
free(tmpfile);
return(0);
}