Fixes to Coverity defects 87308, 87307, 87306, 87074, 87068.

This commit is contained in:
Markus Makela
2015-02-14 07:54:17 +02:00
parent 2477043d11
commit 3bad5dc814
3 changed files with 24 additions and 8 deletions

View File

@ -678,12 +678,14 @@ void *key, *value;
if (!(*keywrite)(fd, key))
{
close(fd);
hashtable_iterator_free(iter);
return -1;
}
if ((value = hashtable_fetch(table, key)) == NULL ||
(*valuewrite)(fd, value) == 0)
{
close(fd);
hashtable_iterator_free(iter);
return -1;
}
rval++;
@ -691,10 +693,13 @@ void *key, *value;
}
/* Now go back and write the count of entries */
lseek(fd, 7L, SEEK_SET);
write(fd, &rval, sizeof(rval));
if(lseek(fd, 7L, SEEK_SET) != -1)
{
write(fd, &rval, sizeof(rval));
}
close(fd);
hashtable_iterator_free(iter);
return rval;
}