summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/tng_io.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c
index 2a8979e..fc7c574 100644
--- a/src/lib/tng_io.c
+++ b/src/lib/tng_io.c
@@ -7337,15 +7337,14 @@ tng_function_status DECLSPECDLLEXPORT tng_molecule_system_copy(tng_trajectory_t
tng_data_dest->n_molecules = tng_data_src->n_molecules;
- molecule_temp = realloc(tng_data_dest->molecules,
- sizeof(struct tng_molecule) * tng_data_dest->n_molecules);
- if(!molecule_temp)
+ free(tng_data_dest->molecules);
+
+ tng_data_dest->molecules = malloc(sizeof(struct tng_molecule) * tng_data_dest->n_molecules);
+ if(!tng_data_dest->molecules)
{
printf("TNG library: Cannot allocate memory (%"PRId64" bytes). %s: %d\n",
sizeof(struct tng_molecule) * tng_data_dest->n_molecules,
__FILE__, __LINE__);
- free(tng_data_dest->molecules);
- tng_data_dest->molecules = 0;
return(TNG_CRITICAL);
}
list_temp = realloc(tng_data_dest->molecule_cnt_list,
contact: Jan Huwald // Impressum