gtx: Fix problems found by static analysis

Several static analysis tools have identified various problems:
 - possible memory leaks                          (scan-build, cppcheck)

To resolve the above problems:
 - fix possible memory leaks by freeing memory

This commit is a reorganization of commits developed by Pat Riehecky,
who ran the static analysis tools and developed the fixes.

Change-Id: Ica9e5a33bf33ae802fed0f1439fc3561d0406713
Reviewed-on: https://gerrit.openafs.org/14685
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: PatRiehecky <jcpunk@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
This commit is contained in:
Cheyenne Wills 2021-07-01 15:39:43 -06:00 committed by Michael Meffie
parent ed81d57a5c
commit 387ab140f5

View File

@ -82,12 +82,13 @@ keymap_BindToString(struct keymap_map *amap, char *astring,
tmap = keymap_Create();
code =
BindIt(amap, tc, KEYMAP_SUBMAP, tmap, NULL, NULL);
if (code) {
free(tmap);
return code;
}
} else {
tmap = amap->entries[tc].u.submap;
code = 0;
}
if (code)
return code;
amap = tmap; /* continue processing this map */
}
} /* while loop */