Fixes some minor code issues found with coverity scan.

This commit is contained in:
Andrea Mazzoleni 2014-05-09 22:07:07 +02:00
parent 8c8b370d4c
commit 23060095c9
4 changed files with 6 additions and 5 deletions

View file

@ -54,6 +54,7 @@ struct snapraid_hash* hash_alloc(struct snapraid_state* state, struct snapraid_d
if (!block_has_updated_hash(&file->blockvec[i])) {
free(buf);
free(hash);
return 0;
}
}

View file

@ -4043,7 +4043,7 @@ void state_write(struct snapraid_state* state)
if (sclose(f) != 0) {
/* LCOV_EXCL_START */
fprintf(stderr, "Error writing the content file '%s' in close(). %s.\n", serrorfile(f), strerror(errno));
fprintf(stderr, "Error closing the content files in close(). %s.\n", strerror(errno));
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}

View file

@ -538,7 +538,7 @@ int sgethex(STREAM* f, void* void_data, int size)
return -1;
/* LCOV_EXCL_STOP */
}
b0 = strdecset[c];
b0 = strdecset[(unsigned char)c];
c = sgetc(f);
if (c == EOF) {
@ -546,7 +546,7 @@ int sgethex(STREAM* f, void* void_data, int size)
return -1;
/* LCOV_EXCL_STOP */
}
b1 = strdecset[c];
b1 = strdecset[(unsigned char)c];
b = (b0 << 4) | b1;
@ -1670,7 +1670,7 @@ int lock_lock(const char* file)
/* LCOV_EXCL_STOP */
}
return 0;
return f;
}
#endif

View file

@ -281,7 +281,7 @@ int raid_test_par(int mode, int nd, size_t size)
/* check memory */
if (raid_mtest_vector(nv, size, v) != 0)
return -1;
goto bail;
/* fill with random */
raid_mrand_vector(nv, size, v);