Commit 82fa758beac7ba2725817465b9117640cd1a9404

Authored by Perry Werneck
1 parent b12a5f51
Exists in master and in 1 other branch develop

Fixing memory management errors.

client/src/core/linux/request.cc
@@ -77,7 +77,7 @@ @@ -77,7 +77,7 @@
77 if(!response.msg) { 77 if(!response.msg) {
78 string message = error.message; 78 string message = error.message;
79 dbus_error_free(&error); 79 dbus_error_free(&error);
80 - throw std::runtime_error(message.c_str()); 80 + throw std::runtime_error(message);
81 } 81 }
82 82
83 dbus_message_iter_init(response.msg, &response.iter); 83 dbus_message_iter_init(response.msg, &response.iter);
@@ -128,7 +128,8 @@ @@ -128,7 +128,8 @@
128 } 128 }
129 129
130 IPC::Request & IPC::Request::push(const bool arg) { 130 IPC::Request & IPC::Request::push(const bool arg) {
131 - return push(DBUS_TYPE_BOOLEAN,&arg); 131 + dbus_bool_t bl = (arg ? 1 : 0);
  132 + return push(DBUS_TYPE_BOOLEAN,&bl);
132 } 133 }
133 134
134 IPC::Request & IPC::Request::push(const uint8_t arg) { 135 IPC::Request & IPC::Request::push(const uint8_t arg) {
client/src/host/properties.cc
@@ -58,7 +58,7 @@ std::vector<TN3270::Attribute> TN3270::Host::getAttributes() const { @@ -58,7 +58,7 @@ std::vector<TN3270::Attribute> TN3270::Host::getAttributes() const {
58 58
59 } 59 }
60 60
61 -void TN3270::Host::setTimeout(time_t timeout) noexcept { 61 +void TN3270::Host::setTimeout(time_t timeout) {
62 this->timeout = timeout; 62 this->timeout = timeout;
63 this->session->setTimeout(timeout); 63 this->session->setTimeout(timeout);
64 } 64 }
client/src/include/lib3270/ipc.h
@@ -856,7 +856,7 @@ @@ -856,7 +856,7 @@
856 } 856 }
857 857
858 // Set properties 858 // Set properties
859 - void setTimeout(time_t timeout = DEFAULT_TIMEOUT) noexcept; 859 + void setTimeout(time_t timeout = DEFAULT_TIMEOUT);
860 860
861 inline void setUnlockDelay(unsigned short delay = 350) { 861 inline void setUnlockDelay(unsigned short delay = 350) {
862 session->setUnlockDelay(delay); 862 session->setUnlockDelay(delay);
client/src/testprogram/testprogram.cc
@@ -103,6 +103,8 @@ @@ -103,6 +103,8 @@
103 103
104 TN3270::Host host{session}; 104 TN3270::Host host{session};
105 105
  106 + host.setTimeout(5);
  107 +
106 //name="url"; 108 //name="url";
107 109
108 cout << endl << endl; 110 cout << endl << endl;
@@ -280,7 +282,17 @@ @@ -280,7 +282,17 @@
280 break; 282 break;
281 283
282 case 'A': 284 case 'A':
283 - testAttributes(session,optarg); 285 +
  286 + try {
  287 +
  288 + testAttributes(session,optarg);
  289 +
  290 + } catch(const std::exception &e) {
  291 +
  292 + cerr << e.what() << endl;
  293 + return -1;
  294 + }
  295 +
284 break; 296 break;
285 297
286 case 'U': 298 case 'U':