Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i.ortho.photo: Fix Resource Leak in find_init.c #4388

Merged
merged 13 commits into from
Oct 12, 2024
12 changes: 8 additions & 4 deletions imagery/i.ortho.photo/lib/find_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
* Find the a camera initial file in the current group (if it exists)
**************************************************************/
#include <grass/gis.h>
#include <grass/glocale.h>

int I_find_initial(char *group)
{
char *element;

element = (char *)G_malloc(80 * sizeof(char));
char element[GNAME_MAX + 6];

if (group == NULL || *group == 0)
return 0;
sprintf(element, "group/%s", group);

if (snprintf(element, GNAME_MAX, "group/%s", group) >= GNAME_MAX) {
G_warning(_("Group name <%s> truncated"), group);
nilason marked this conversation as resolved.
Show resolved Hide resolved
return 0;
}

return G_find_file(element, "INIT_EXP", G_mapset()) != NULL;
}
Loading