The pointer returned by operator new can't be null, but it's compared with null at websocket.cpp:718.
Change-Id: I6f4892be9d85d2bce6154a60d3c7f96a923ada4e
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
sclboolean ret = FALSE;
if (m_impl == NULL) {
/* There could be other backend implementations.. */
- m_impl = new CSCLCoreUIEFL;
- if (m_impl) {
+ try {
+ m_impl = new CSCLCoreUIEFL;
ret = m_impl->init();
}
+ catch (const std::bad_alloc& e) {
+ LOGE("bad alloc");
+ }
}
return ret;
}
ISE_MESSAGE_COMMAND_STRINGS[ISE_MESSAGE_COMMAND_GET_IMDATA], values)) {
if (values.size() > 0 && buf && len) {
int string_length = values.at(0).length();
- (*buf) = new char[string_length + 1];
- if (*buf) {
+ try {
+ (*buf) = new char[string_length + 1];
strncpy(*buf, values.at(0).c_str(), string_length);
/* Make sure this is a null-terminated string */
*(*buf + string_length) = '\0';
*len = string_length;
+ } catch (const std::bad_alloc& e) {
+ LOGE("Bad alloc");
}
}
} else {