Problem when converting char* to string
<p>When I convert char* to an string it gives an bad memory allocation error in 'new.cpp' . I used following method to convert char* called 'strData' and 'strOrg' to string.</p>

<pre><code>   const char* strData = dt.data();
   int length2 = dt.length();
   string s1(strData);
</code></pre>

<p>First time it work without any problem. But in the second convertion it gives above error. When I swap the two conversion in the order, it give the error always in the second conversion regardless of the char* I am converting. Whole code is shown in the following.</p>

<pre><code>    mysqlpp::Query query = conn.query("SELECT data,origin from image where id =2");
    mysqlpp::UseQueryResult res = query.use();
    mysqlpp::Row eee= res.fetch_row();
    mysqlpp::Row::reference dt = eee.at(0);
    mysqlpp::Row::reference org = eee.at(1);

    const char* strData = dt.data();
    int length2 = dt.length();
    string s1(strData);
    istringstream is1(s1);  
    char * imgData =  new char;
    is1.read(reinterpret_cast&lt;char *&gt; (imgData), length2);
    delete [] strData;

    const char* strOrg = org.data();
    int length3 = org.length();
    string s2(strOrg);
    istringstream is2(s2);  
    char * imgOrg =  new char;
    is2.read(reinterpret_cast&lt;char *&gt; (imgOrg), length3);
    delete [] strOrg;
</code></pre>

<p>This where the error comes  from</p>

<pre><code>    void *__CRTDECL operator new(size_t size) _THROW1(_STD bad_alloc)
    {       
    void *p;
    while ((p = malloc(size)) == 0)
            if (_callnewh(size) == 0)
            {       // report no memory
            static const std::bad_alloc nomem;
            _RAISE(nomem);
            }

    return (p);
    }
</code></pre>

<p>Please help me to solve this problem. It is urgent</p>
