# Problem with glGetInfoLogARB and auto_ptr

This topic is 4645 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to read a log from a compilation of a GLSL shader. Using a normal buffer, this works fine. However, since I am using exceptions, I'd like to make the function atomic, and to do this, I've tried to use a std::auto_ptr to retrieve the log.
int infoLogLength = 0;

// This works
char *buffer = new char[infoLogLength];

// This crashes
std::auto_ptr<char> buffera = new char[infoLogLength];

I would like to use the second piece, but it crashes somewhere in my ATI driver. The first piece works like it should, but could leak memory if something goes wrong. It's probably something to do with the auto_ptr, but since I don't have a lot of experience with them, I haven't been able to fix this. Any ideas?

##### Share on other sites
I don't see why that should not work. Except that it should be:

std::auto_ptr<char> buffera(new char[infoLogLength]);

As you posted it, it does not compile.

Try using a vector and see if that works, like:

std::vector<char> buffera;
buffera.resize(infoLogLength);

##### Share on other sites
It's strange because that code did compile on Visual C++ Express Beta 2.

But your fix did work. I was just using the auto_ptr incorrectly. Thanks.