Message ID | 20180422192148.7320-2-nicolas.iooss@m4x.org (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
On Sun, Apr 22, 2018 at 12:21 PM, Nicolas Iooss <nicolas.iooss@m4x.org> wrote: > clang's static analyzer reports a potential memory leak because the > buffers allocated in pc and fc are not freed in main(), in sestatus.c. > Free these buffers properly. > > Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org> > --- > policycoreutils/sestatus/sestatus.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/policycoreutils/sestatus/sestatus.c b/policycoreutils/sestatus/sestatus.c > index d7f198c2fa0d..9a92e72ff4fd 100644 > --- a/policycoreutils/sestatus/sestatus.c > +++ b/policycoreutils/sestatus/sestatus.c > @@ -436,6 +436,7 @@ int main(int argc, char **argv) > printf("%s\n", context); > freecon(context); > } > + free(pc[i]); > } > > printf("\nFile contexts:\n"); > @@ -478,6 +479,7 @@ int main(int argc, char **argv) > freecon(context); > } > } > + free(fc[i]); > } > > return 0; > -- > 2.17.0 > > ack on both patches in this series.
Merged: https://github.com/SELinuxProject/selinux/pull/94 On Mon, Apr 23, 2018 at 9:54 AM, William Roberts <bill.c.roberts@gmail.com> wrote: > On Sun, Apr 22, 2018 at 12:21 PM, Nicolas Iooss <nicolas.iooss@m4x.org> wrote: >> clang's static analyzer reports a potential memory leak because the >> buffers allocated in pc and fc are not freed in main(), in sestatus.c. >> Free these buffers properly. >> >> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org> >> --- >> policycoreutils/sestatus/sestatus.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/policycoreutils/sestatus/sestatus.c b/policycoreutils/sestatus/sestatus.c >> index d7f198c2fa0d..9a92e72ff4fd 100644 >> --- a/policycoreutils/sestatus/sestatus.c >> +++ b/policycoreutils/sestatus/sestatus.c >> @@ -436,6 +436,7 @@ int main(int argc, char **argv) >> printf("%s\n", context); >> freecon(context); >> } >> + free(pc[i]); >> } >> >> printf("\nFile contexts:\n"); >> @@ -478,6 +479,7 @@ int main(int argc, char **argv) >> freecon(context); >> } >> } >> + free(fc[i]); >> } >> >> return 0; >> -- >> 2.17.0 >> >> > ack on both patches in this series.
diff --git a/policycoreutils/sestatus/sestatus.c b/policycoreutils/sestatus/sestatus.c index d7f198c2fa0d..9a92e72ff4fd 100644 --- a/policycoreutils/sestatus/sestatus.c +++ b/policycoreutils/sestatus/sestatus.c @@ -436,6 +436,7 @@ int main(int argc, char **argv) printf("%s\n", context); freecon(context); } + free(pc[i]); } printf("\nFile contexts:\n"); @@ -478,6 +479,7 @@ int main(int argc, char **argv) freecon(context); } } + free(fc[i]); } return 0;
clang's static analyzer reports a potential memory leak because the buffers allocated in pc and fc are not freed in main(), in sestatus.c. Free these buffers properly. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org> --- policycoreutils/sestatus/sestatus.c | 2 ++ 1 file changed, 2 insertions(+)