Hi folks,<br><br>I'm going to re-open this thread for a moment. So, currently I have this IDL representation:<br><br>typedef sequence<octet> StringData;<br>struct MyStruct {<br> StringData s;<br>};<br><br>Then I define a function to convert a char * to a StringData:<br>
<br>StringData *convert( char *char_p, int len ) {<br> CORBA::Octet *chars = new CORBA::Octet[len];<br> for ( int i = 0; i < len; i++ ) {<br> chars[i] = char_p[i];<br> }<br> return new StringData(len, len, chars, false);<br>
}<br><br>It is then used like this:<br><br>void foo( char *p, int len ) {<br> struct MyStruct myStruct;<br> myStruct.s = StringData_var( convert( p, len ) );<br> // ... do stuff<br>}<br><br>Now my question is, is the memory I have allocated here with the new StringData and new Octet freed when foo() returns? How much does the StringData_var take care of -- i.e., does it free the Octets? Could someone clarify the meaning of the fourth parameter to new StringData()? I have a feeling that it might be relevant here.<br>
<br>Thanks,<br>David<br>