Skip to content
Open
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
9 changes: 7 additions & 2 deletions src/utility/BLEUuid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

#include "BLEUuid.h"

BLEUuid::BLEUuid(const char * str) :
_str(str)
BLEUuid::BLEUuid(const char * str)
{
_str = strdup(str);
char temp[] = {0, 0, 0};

memset(_data, 0x00, sizeof(_data));
Expand Down Expand Up @@ -56,6 +56,11 @@ BLEUuid::BLEUuid(const char * str) :
}
}

BLEUuid::~BLEUuid()
{
free(_str);
}

const char* BLEUuid::str() const
{
return _str;
Expand Down
3 changes: 2 additions & 1 deletion src/utility/BLEUuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class BLEUuid
{
public:
BLEUuid(const char * str);
~BLEUuid();

const char* str() const;
const uint8_t * data() const;
Expand All @@ -36,7 +37,7 @@ class BLEUuid
static const char* uuidToString(const uint8_t* data, uint8_t length);

private:
const char* _str;
char* _str;
uint8_t _data[BLE_UUID_MAX_LENGTH];
uint8_t _length;
};
Expand Down