Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  23 Mar 2022, Konstantin Olchanski, Bug Fix, mhttpd bug fixed 
    Reply  24 Mar 2022, Stefan Ritt, Bug Fix, mhttpd bug fixed 
       Reply  24 Mar 2022, Konstantin Olchanski, Bug Fix, mhttpd bug fixed 
          Reply  24 Mar 2022, Stefan Ritt, Bug Fix, mhttpd bug fixed 
             Reply  24 Mar 2022, Konstantin Olchanski, Bug Fix, mhttpd bug fixed 
Message ID: 2366     Entry time: 24 Mar 2022     In reply to: 2364     Reply to this: 2368
Author: Stefan Ritt 
Topic: Bug Fix 
Subject: mhttpd bug fixed 
> 1st wget stops (by ctrl-C), socket is closed, mongoose frees it's mg_connection object
> (corresponding worker is still labouring, hmm... actually sleeping, and now has a stale nc pointer)
> 
> 2nd wget starts, new socket is opened, mongoose allocates a new mg_connection object,
> but malloc() gives it back the same memory we just freed(), and the 1st wget's worker thread
> nc pointer is no longer stale, but points to 2nd wget's connection.

Why don't we CLEAR the memory (memset(object,0,sizeof(object)) before the free(), this way it cannot be 
mistakenly re-used by the next thread.

Stefan
ELOG V3.1.4-2e1708b5