From: guido@trentalancia.com (Guido Trentalancia) Date: Sat, 30 Sep 2017 01:29:28 +0200 Subject: [refpolicy] [PATCH] fc_sort: memory leakages (was: Pull Request for fixing memory leak warning) In-Reply-To: References: <1506643940.32317.6.camel@trentalancia.com> <1506703966.24492.1.camel@trentalancia.com> Message-ID: <1506727768.25420.5.camel@trentalancia.com> To: refpolicy@oss.tresys.com List-Id: refpolicy.oss.tresys.com On Fri, 29/09/2017 at 09.30 -0700, William Roberts write: > On Fri, Sep 29, 2017 at 9:52 AM, Guido Trentalancia via refpolicy > wrote: > > On Thu, 28/09/2017 at 15.24 -0700, William Roberts wrote: > > > On Thu, Sep 28, 2017 at 5:12 PM, Guido Trentalancia via refpolicy > > > wrote: [...] > > > The PR was mostly to avoid warnings with a static analysis tool > > > IIUC. > > > I was trying to avoid any fork of that code between upstream and > > > Google. > > > > > > Do you plan on applying this change to the repo? > > > > > > I've reached out to the google engineers here: > > > https://android-review.googlesource.com/#/c/platform/system/sepol > > > icy/ > > > +/465218/ > > > > > > and in the PR > > > https://github.com/TresysTechnology/refpolicy/pull/125 > > > > > > So hopefully they can try it and let us know if it avoids the > > > errors > > > with their analysis tools, > > > if valgrind reports 0 leaks, it likely will satisfy the static > > > analysis. > > > > The patch that I attached does not work properly and it needs > > further > > work, because it leads to a failure in getline() and an empty > > output > > file. > > > > I hope it helps. > > That's not very helpful IMHO, but thanks anyways. They took the PR > upstream, so that should fix there static analysis issue and avoid > any > forking. I found some more time to look at this and the result is that I have prepared a new patch version (v3), which should fix all problems without introducing bugs. The v3 patch passes all valgrind tests and also produces the expected output file. Regards, Guido