diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2012-01-20 01:02:36 +0100 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2012-01-20 01:02:36 +0100 |
commit | aaab10075397cb4f2ec262c5d478f7ea8acd2d23 (patch) | |
tree | c02f41b1102b79d43e7d93a4ebf83f14d86bf8b1 /methods/gpgv.cc | |
parent | 38ff3de6a82c4dc03adcef98919ff6bd6dc1603a (diff) |
fix a few esoteric cppcheck errors/warnings/infos
Diffstat (limited to 'methods/gpgv.cc')
-rw-r--r-- | methods/gpgv.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 2b2aba017..25ba0d063 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -98,8 +98,16 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, // Read a line. Sigh. while ((c = getc(pipein)) != EOF && c != '\n') { - if (bufferoff == buffersize) - buffer = (char *) realloc(buffer, buffersize *= 2); + if (bufferoff == buffersize) + { + char* newBuffer = (char *) realloc(buffer, buffersize *= 2); + if (newBuffer == NULL) + { + free(buffer); + return "Couldn't allocate a buffer big enough for reading"; + } + buffer = newBuffer; + } *(buffer+bufferoff) = c; bufferoff++; } |