mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-23 04:44:03 +01:00
Check in malloc
This commit is contained in:
parent
cd6de216b8
commit
1b846de413
@ -132,6 +132,13 @@ qmckl_exit_code
|
|||||||
qmckl_vector_free( qmckl_context context,
|
qmckl_vector_free( qmckl_context context,
|
||||||
qmckl_vector* vector)
|
qmckl_vector* vector)
|
||||||
{
|
{
|
||||||
|
if (vector == NULL) {
|
||||||
|
return qmckl_failwith( context,
|
||||||
|
QMCKL_INVALID_ARG_2,
|
||||||
|
"qmckl_vector_free",
|
||||||
|
"Null pointer");
|
||||||
|
}
|
||||||
|
|
||||||
/* Always true */
|
/* Always true */
|
||||||
assert (vector->data != NULL);
|
assert (vector->data != NULL);
|
||||||
|
|
||||||
@ -213,6 +220,13 @@ qmckl_exit_code
|
|||||||
qmckl_matrix_free( qmckl_context context,
|
qmckl_matrix_free( qmckl_context context,
|
||||||
qmckl_matrix* matrix)
|
qmckl_matrix* matrix)
|
||||||
{
|
{
|
||||||
|
if (matrix == NULL) {
|
||||||
|
return qmckl_failwith( context,
|
||||||
|
QMCKL_INVALID_ARG_2,
|
||||||
|
"qmckl_matrix_free",
|
||||||
|
"Null pointer");
|
||||||
|
}
|
||||||
|
|
||||||
/* Always true */
|
/* Always true */
|
||||||
assert (matrix->data != NULL);
|
assert (matrix->data != NULL);
|
||||||
|
|
||||||
@ -307,6 +321,13 @@ qmckl_exit_code
|
|||||||
qmckl_tensor_free( qmckl_context context,
|
qmckl_tensor_free( qmckl_context context,
|
||||||
qmckl_tensor* tensor)
|
qmckl_tensor* tensor)
|
||||||
{
|
{
|
||||||
|
if (tensor == NULL) {
|
||||||
|
return qmckl_failwith( context,
|
||||||
|
QMCKL_INVALID_ARG_2,
|
||||||
|
"qmckl_tensor_free",
|
||||||
|
"Null pointer");
|
||||||
|
}
|
||||||
|
|
||||||
/* Always true */
|
/* Always true */
|
||||||
assert (tensor->data != NULL);
|
assert (tensor->data != NULL);
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ qmckl_set_point (qmckl_context context,
|
|||||||
assert (ctx != NULL);
|
assert (ctx != NULL);
|
||||||
|
|
||||||
qmckl_exit_code rc;
|
qmckl_exit_code rc;
|
||||||
if (ctx->point.num < num) {
|
if (ctx->point.num != num) {
|
||||||
|
|
||||||
if (ctx->point.coord.data != NULL) {
|
if (ctx->point.coord.data != NULL) {
|
||||||
rc = qmckl_matrix_free(context, &(ctx->point.coord));
|
rc = qmckl_matrix_free(context, &(ctx->point.coord));
|
||||||
|
@ -1086,7 +1086,7 @@ qmckl_trexio_read(const qmckl_context context, const char* file_name, const int6
|
|||||||
|
|
||||||
qmckl_exit_code rc;
|
qmckl_exit_code rc;
|
||||||
char file_name_new[size_max+1];
|
char file_name_new[size_max+1];
|
||||||
strncpy(file_name_new, file_name, size_max+1);
|
strncpy(file_name_new, file_name, size_max);
|
||||||
file_name_new[size_max] = '\0';
|
file_name_new[size_max] = '\0';
|
||||||
|
|
||||||
#ifdef HAVE_TREXIO
|
#ifdef HAVE_TREXIO
|
||||||
|
Loading…
Reference in New Issue
Block a user