Skip to content
Snippets Groups Projects
Commit bebecd60 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

coverity fix

parent 248e545a
No related branches found
No related tags found
No related merge requests found
......@@ -218,6 +218,7 @@ void ChainComplex::Inclusion(int lowDim, int highDim)
gmp_matrix_get_elem(elem, i, i, normalForm->canonical);
if(mpz_cmp_si(elem,0) == 0){
destroy_gmp_matrix(Bbasis);
destroy_gmp_normal_form(normalForm);
return;
}
......@@ -251,6 +252,7 @@ void ChainComplex::Inclusion(int lowDim, int highDim)
else {
destroy_gmp_matrix(Zbasis);
destroy_gmp_matrix(LB);
destroy_gmp_normal_form(normalForm);
return;
}
}
......
......@@ -409,8 +409,13 @@ int GModel::_readMSH2(const std::string &name)
}
}
int *indices = new int[numVertices];
for(int j = 0; j < numVertices; j++)
if(fscanf(fp, "%d", &indices[j]) != 1){ fclose(fp); return 0; }
for(int j = 0; j < numVertices; j++){
if(fscanf(fp, "%d", &indices[j]) != 1){
delete [] indices;
fclose(fp);
return 0;
}
}
std::vector<MVertex*> vertices;
if(vertexVector.size()){
if(!getVertices(numVertices, indices, vertexVector, vertices, minVertex)){
......@@ -521,7 +526,11 @@ int GModel::_readMSH2(const std::string &name)
unsigned int n = 1 + numTags + numVertices;
int *data = new int[n];
for(int i = 0; i < numElms; i++) {
if(fread(data, sizeof(int), n, fp) != n){ fclose(fp); return 0; }
if(fread(data, sizeof(int), n, fp) != n){
delete [] data;
fclose(fp);
return 0;
}
if(swap) SwapBytes((char*)data, sizeof(int), n);
int num = data[0];
int physical = (numTags > 0) ? data[1] : 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment