aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/image.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-07-21 11:51:56 +0200
committerThomas White <taw@physics.org>2021-07-21 15:34:31 +0200
commit6d94d4115c254d344bbb927596a7141ef39fd298 (patch)
tree652d07c4d6a9521c9359aa13bbda27309f53e6f8 /libcrystfel/src/image.c
parent50cf52b0bc0baa683b9508568131a3f6281bf4ff (diff)
Add missing cleanup on error paths
Diffstat (limited to 'libcrystfel/src/image.c')
-rw-r--r--libcrystfel/src/image.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index 74e6d8d3..3c5af479 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -603,7 +603,10 @@ int create_detgeom(struct image *image, const DataTemplate *dtempl)
if ( detgeom == NULL ) return 1;
detgeom->panels = malloc(dtempl->n_panels*sizeof(struct detgeom_panel));
- if ( detgeom->panels == NULL ) return 1;
+ if ( detgeom->panels == NULL ) {
+ free(detgeom);
+ return 1;
+ }
detgeom->n_panels = dtempl->n_panels;
@@ -1493,7 +1496,10 @@ char **image_expand_frames(const DataTemplate *dtempl,
list = malloc(sizeof(char *));
if ( list == NULL ) return NULL;
list[0] = strdup("//");
- if ( list[0] == NULL ) return NULL;
+ if ( list[0] == NULL ) {
+ free(list);
+ return NULL;
+ }
*n_frames = 1;
return list;
}