Maemo: Introduce automatic cleanup for another pointer.

This commit is contained in:
ck
2010-01-13 10:45:26 +01:00
parent f196700ee3
commit e78763bb04

View File

@@ -48,6 +48,7 @@
#include <ne7ssh.h>
#include <QtCore/QFileInfo>
#include <QtCore/QScopedPointer>
#include <QtCore/QStringBuilder>
#include <cstdio>
@@ -132,12 +133,12 @@ void MaemoInteractiveSshConnection::runCommand(const QString &command)
const char * const error = lastError();
if (error)
throw MaemoSshException(tr("SSH error: %1").arg(error));
const char * const output = ssh.readAndReset(channel(), alloc);
if (output) {
emit remoteOutput(QString::fromUtf8(output));
QScopedPointer<char, QScopedPointerArrayDeleter<char> >
output(ssh.readAndReset(channel(), alloc));
if (output.data()) {
emit remoteOutput(QString::fromUtf8(output.data()));
if (!done)
done = strstr(output, m_prompt) != 0;
delete[] output;
done = strstr(output.data(), m_prompt) != 0;
}
} while (!done && !stopRequested());
}