sensord: fix double-free issue 61/143361/1
authorkibak.yoon <kibak.yoon@samsung.com>
Wed, 9 Aug 2017 10:39:52 +0000 (19:39 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Wed, 9 Aug 2017 10:39:52 +0000 (19:39 +0900)
- If the server is terminated unexpectedly, sensor library releases the memory
  of channel automatically. At that time, if client calls disconnect(),
  double-free problem is invoked.
- Because it is right situation to call disconnect() explicitly,
  the auto-release code should be removed.

Change-Id: I31894354eb2d11549dbe0382ce865de6beea89d4
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/shared/channel_event_handler.cpp

index 6ca1e25..cc8a2bb 100644 (file)
@@ -46,14 +46,12 @@ bool channel_event_handler::handle(int fd, event_condition condition)
 
        if (condition & (EVENT_HUP)) {
                m_ch->disconnect();
-               delete m_ch;
                m_ch = NULL;
                return false;
        }
 
        if (!m_ch->read_sync(msg, false)) {
                m_ch->disconnect();
-               delete m_ch;
                m_ch = NULL;
                return false;
        }