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 77 if(!response.msg) {
78 78 string message = error.message;
79 79 dbus_error_free(&error);
80   - throw std::runtime_error(message.c_str());
  80 + throw std::runtime_error(message);
81 81 }
82 82  
83 83 dbus_message_iter_init(response.msg, &response.iter);
... ... @@ -128,7 +128,8 @@
128 128 }
129 129  
130 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 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 58  
59 59 }
60 60  
61   -void TN3270::Host::setTimeout(time_t timeout) noexcept {
  61 +void TN3270::Host::setTimeout(time_t timeout) {
62 62 this->timeout = timeout;
63 63 this->session->setTimeout(timeout);
64 64 }
... ...
client/src/include/lib3270/ipc.h
... ... @@ -856,7 +856,7 @@
856 856 }
857 857  
858 858 // Set properties
859   - void setTimeout(time_t timeout = DEFAULT_TIMEOUT) noexcept;
  859 + void setTimeout(time_t timeout = DEFAULT_TIMEOUT);
860 860  
861 861 inline void setUnlockDelay(unsigned short delay = 350) {
862 862 session->setUnlockDelay(delay);
... ...
client/src/testprogram/testprogram.cc
... ... @@ -103,6 +103,8 @@
103 103  
104 104 TN3270::Host host{session};
105 105  
  106 + host.setTimeout(5);
  107 +
106 108 //name="url";
107 109  
108 110 cout << endl << endl;
... ... @@ -280,7 +282,17 @@
280 282 break;
281 283  
282 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 296 break;
285 297  
286 298 case 'U':
... ...