Introduction
Introduction Statistics Contact Development Disclaimer Help
tsimulation.c: handle memory around grain reads - granular - granular dynamics …
git clone git://src.adamsgaard.dk/granular
Log
Files
Refs
README
LICENSE
---
commit 8d4e5dd081797027aaa0e8b0b344ec02009f2499
parent d0dd8f9a311789e5c00feef1a1b27173c4aa95a9
Author: Anders Damsgaard <[email protected]>
Date: Thu, 8 Apr 2021 22:36:16 +0200
simulation.c: handle memory around grain reads
Diffstat:
M simulation.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/simulation.c b/simulation.c
t@@ -66,9 +66,13 @@ sim_read_grains(struct simulation *sim, FILE *stream)
char *line = NULL;
size_t linesize = 0;
ssize_t linelen;
+ struct grain *g;
- while ((linelen = getline(&line, &linesize, stream)) > 0)
- sim_add_grain(sim, grain_read(line));
+ while ((linelen = getline(&line, &linesize, stream)) > 0) {
+ g = grain_read(line);
+ sim_add_grain(sim, g);
+ free(g);
+ }
free(line);
}
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.