summaryrefslogtreecommitdiff
path: root/lib/clippy.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2021-02-20 07:38:06 -0500
committerDonald Sharp <sharpd@nvidia.com>2021-02-20 07:40:01 -0500
commitf52aee04b3839b5c2bcfb2a5114b698e39925df2 (patch)
tree93528d7fa4c9de298186a852c258d122ceb429b6 /lib/clippy.c
parent1c0f3e760a43000880897e05b904e4bf0c117e76 (diff)
lib: Free memory leak in error path in clippy
When running clippy, the main function in it's error path could leak the memory pointed to by name. Fix this. This was/is reported by clang SA. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/clippy.c')
-rw-r--r--lib/clippy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/clippy.c b/lib/clippy.c
index b52c48ec92..6223697ae9 100644
--- a/lib/clippy.c
+++ b/lib/clippy.c
@@ -68,6 +68,8 @@ int main(int argc, char **argv)
fp = fopen(pyfile, "r");
if (!fp) {
fprintf(stderr, "%s: %s\n", pyfile, strerror(errno));
+
+ free(name);
return 1;
}
} else {
@@ -86,6 +88,8 @@ int main(int argc, char **argv)
if (PyRun_AnyFile(fp, pyfile)) {
if (PyErr_Occurred())
PyErr_Print();
+
+ free(name);
return 1;
}
Py_Finalize();