Commit a53f07a8 authored by Bastien Nocera's avatar Bastien Nocera

mindtct: Fix memory leak in error path in gen_image_maps()

Free the maps if we're not returning them.

libfprint/nbis/mindtct/maps.c:176:14: warning: Potential leak of memory pointed to by 'direction_map'
      return(ret);
             ^~~
libfprint/nbis/mindtct/maps.c:195:14: warning: Potential leak of memory pointed to by 'low_contrast_map'
      return(ret);
             ^~~
libfprint/nbis/mindtct/maps.c:195:14: warning: Potential leak of memory pointed to by 'low_flow_map'
      return(ret);
             ^~~
parent c3e996b9
......@@ -159,6 +159,9 @@ int gen_image_maps(int **odmap, int **olcmap, int **olfmap, int **ohcmap,
}
if((ret = morph_TF_map(low_flow_map, mw, mh, lfsparms))){
free(direction_map);
free(low_contrast_map);
free(low_flow_map);
return(ret);
}
......@@ -173,6 +176,9 @@ int gen_image_maps(int **odmap, int **olcmap, int **olfmap, int **ohcmap,
/* 5. Interpolate INVALID direction blocks with their valid neighbors. */
if((ret = interpolate_direction_map(direction_map, low_contrast_map,
mw, mh, lfsparms))){
free(direction_map);
free(low_contrast_map);
free(low_flow_map);
return(ret);
}
......@@ -192,6 +198,9 @@ int gen_image_maps(int **odmap, int **olcmap, int **olfmap, int **ohcmap,
/* 9. Generate High Curvature Map from interpolated Direction Map. */
if((ret = gen_high_curve_map(&high_curve_map, direction_map, mw, mh,
lfsparms))){
free(direction_map);
free(low_contrast_map);
free(low_flow_map);
return(ret);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment