mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 20:36:01 +01:00
Fixed memory leak
This commit is contained in:
parent
93b5e48a6b
commit
7642d336d1
@ -203,6 +203,7 @@ qmckl_context qmckl_context_create() {
|
||||
const size_t size = 128L;
|
||||
qmckl_memory_info_struct * new_array = calloc(size, sizeof(qmckl_memory_info_struct));
|
||||
if (new_array == NULL) {
|
||||
free(ctx);
|
||||
return QMCKL_NULL_CONTEXT;
|
||||
}
|
||||
memset( &(new_array[0]), 0, size * sizeof(qmckl_memory_info_struct) );
|
||||
|
@ -126,6 +126,7 @@ void* qmckl_malloc(qmckl_context context, const qmckl_memory_info_struct info) {
|
||||
sizeof(qmckl_memory_info_struct));
|
||||
if (new_array == NULL) {
|
||||
qmckl_unlock(context);
|
||||
free(pointer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user