commit 05f060f5c27ff4fe9b690eda69c991dc88593844
parent fdf19b6be2292aecf595a39ffbb3a3cf921857f2
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 9 Nov 2015 16:36:42 +0100
Fix a memory access error
The thetas/phis mesh arrays were released even though they were not
initialised leading to memory corruption.
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/schiff_args.c b/src/schiff_args.c
@@ -347,8 +347,6 @@ schiff_args_init
}
if(optind == argc) {
- fprintf(stderr,
-"Enter the optical properties. Type ^D (i.e. CTRL+d) to stop the sequence:\n");
res = schiff_optical_properties_load_stream(&args->properties, stdin, "stdin");
} else {
res = schiff_optical_properties_load(&args->properties, argv[optind]);
diff --git a/src/schiff_mesh.c b/src/schiff_mesh.c
@@ -153,6 +153,8 @@ schiff_mesh_init_sphere
setup_sphere_indices(&sphere->indices, nthetas, nphis);
exit:
+ darray_sincos_release(&sphere->thetas);
+ darray_sincos_release(&sphere->phis);
return res;
error:
schiff_mesh_release(sphere);
@@ -326,11 +328,11 @@ schiff_mesh_release(struct schiff_mesh* mesh)
break;
case SCHIFF_POLAR:
darray_uint_release(&mesh->vertices.polar);
+ darray_sincos_release(&mesh->thetas);
+ darray_sincos_release(&mesh->phis);
break;
default: FATAL("Unreachable code\n"); break;
}
darray_uint_release(&mesh->indices);
- darray_sincos_release(&mesh->thetas);
- darray_sincos_release(&mesh->phis);
}