Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call serial_free when Serial object is destroyed #1653

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions libraries/mbed/api/SerialBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ class SerialBase {

protected:
SerialBase(PinName tx, PinName rx);
virtual ~SerialBase() {
}
virtual ~SerialBase();

int _base_getc();
int _base_putc(int c);
Expand Down
4 changes: 4 additions & 0 deletions libraries/mbed/common/SerialBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ SerialBase::SerialBase(PinName tx, PinName rx) :
serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this);
}

SerialBase::~SerialBase() {
serial_free(&_serial);
}

void SerialBase::baud(int baudrate) {
serial_baud(&_serial, baudrate);
_baud = baudrate;
Expand Down