OpenWaterAnalytics / EPANET

The Water Distribution System Hydraulic and Water Quality Analysis Toolkit
MIT License
279 stars 204 forks source link

memory leak #44

Closed mauriziocingi closed 8 years ago

mauriziocingi commented 8 years ago

at lines 3114-3117 of epanet.c function allocdata() allocates memory for node coordinates

      if (Coordflag == TRUE)
      {
        Coord   = (Scoord *) calloc(MaxNodes+1,  sizeof(Scoord));
      }

while freedata() does not deallocate.

We need to add something like:

      if (Coordflag == TRUE)  free(Coord   );
eladsal commented 8 years ago

Good catch, my bad. Your fix should go after line 3264

Would you like to push a patch or you want me to commit the fix?

mauriziocingi commented 8 years ago

I can do it.