Browse Source

afc: Fix message leak when GUI message queue is unavailable

Delete the message when getMessageQueueToGUI() returns null.
The message is allocated in updateDeviceSetLists(), but was only
transferred to the GUI message queue when the queue existed.
Without a queue, the message was never released, causing a
resource leak reported by Coverity.

Keep the existing behavior of pushing the message to the GUI
queue when available, and explicitly delete it otherwise.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
chirpmodem-v8.1.0
Robin Getz 4 weeks ago
parent
commit
11775ea7a7
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 2
      plugins/feature/afc/afc.cpp

2
plugins/feature/afc/afc.cpp

@ -317,6 +317,8 @@ void AFC::updateDeviceSetLists() @@ -317,6 +317,8 @@ void AFC::updateDeviceSetLists()
if (getMessageQueueToGUI()) {
getMessageQueueToGUI()->push(msg);
} else {
delete msg;
}
}

Loading…
Cancel
Save