Skip to content

Commit

Permalink
Fix Resource Leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham Vasudeo Desai committed Sep 25, 2024
1 parent 7c651c3 commit ba4177c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions imagery/i.ortho.photo/lib/find_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@
int I_find_initial(char *group)
{
char *element;
int file_exists;

element = (char *)G_malloc(80 * sizeof(char));

if (group == NULL || *group == 0)
if (group == NULL || *group == 0) {
G_free(element);
return 0;
}
sprintf(element, "group/%s", group);
return G_find_file(element, "INIT_EXP", G_mapset()) != NULL;
file_exists = G_find_file(element, "INIT_EXP", G_mapset()) != NULL;
G_free(element);
return file_exists;
}

0 comments on commit ba4177c

Please sign in to comment.