]> pilppa.com Git - libplpbus.git/commitdiff
memory leak fixes
authorMika Laitio <lamikr@pilppa.org>
Wed, 25 Jul 2012 13:19:09 +0000 (16:19 +0300)
committerMika Laitio <lamikr@pilppa.org>
Wed, 25 Jul 2012 13:19:09 +0000 (16:19 +0300)
Signed-off-by: Mika Laitio <lamikr@pilppa.org>
src/idl/RequestResponseBus.idl
src/plpbus/BusMessage.hh
src/plpbus/OrbServerImpl.cc

index 0bbd1f0abf3ff005ae2c0ccd9aa90060a359180b..b3617fa7ca5a54cd667bcf1fe7caf321dc3031ed 100644 (file)
@@ -5,11 +5,10 @@ module plpbus_orb {
        struct DataItem {
                string name;
                any value;
-                                       string str_value;
+               string str_value;
        };
        
        typedef sequence<DataItem> DataItemSequence;
-       
 
        interface OrbClient {
                // send event to orb client
index 05fba365c5ad78ae1aee095de9e2d5c8421b2773..3a2cd093cd083118a3845fe5d7ef4fada2459ea3 100644 (file)
 
 #include <string>
 
+#include "RequestResponseBus.hh"
+
+using namespace plpbus_orb;
+
 namespace plpbus {
        class BusMessage
        {
                public:
-                       void    *_dataItemSeq;
+                       DataItemSequence        *_dataItemSeq;
 
                        BusMessage(long type_param);
                        BusMessage(long type_param, const char *arg_name_param, const char *arg_string_value_param);
index 0d98badf838b4ea12b620a378d4c2cb8d3e71217..1207f912c31d3900d8a78cf13a0dfcee8b22097a 100644 (file)
@@ -105,25 +105,25 @@ void OrbServerImpl::send_dataitem_message_and_request_response(OrbClient_ptr res
        }
 }
 
+void copy( const DataItemSequence& orig_seq )
+{
+       DataItemSequence new_seq;
+
+       new_seq = orig_seq;
+}
+
 CORBA::Long OrbServerImpl::send_dataitem_message_and_wait_response(const DataItemSequence& req_seq_param,
                                                                DataItemSequence_out rsp_seq_param) {
-       BusMessage              *msg_req;
-       BusMessage              *msg_rsp;
-       DataItemSequence        *seq;
-       int                     err_flg;
+       BusMessage      *msg_req;
+       BusMessage      *msg_rsp;
+       int             err_flg;
 
-       seq     = NULL;
-       msg_rsp = NULL;
        msg_req = new BusMessageInternal(req_seq_param);
        msg_rsp = new BusMessage(msg_req->get_type(&err_flg));
        _listener->request_received(msg_req, msg_rsp);
-       if (msg_rsp != NULL) {
-               seq     = (DataItemSequence *)msg_rsp->_dataItemSeq;
-       }
-       else {
-               seq     = new DataItemSequence();
-       }
-       rsp_seq_param._data     = seq;
+       rsp_seq_param._data     = new DataItemSequence(*(msg_rsp->_dataItemSeq));
+       delete(msg_req);
+       delete(msg_rsp);
 
        return 0;
 }