Merge pull request #42 from wookietreiber/cppcheck-test

implementing the basic cppcheck test
pull/49/head
Christian Krause 9 years ago
commit f35af1ae52

@ -6,7 +6,7 @@ compiler:
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq asciidoc libarchive-dev liblzma-dev xz-utils
- sudo apt-get install -qq asciidoc cppcheck libarchive-dev liblzma-dev xz-utils
script:
- autoconf --version

@ -1,5 +1,6 @@
#include "pixz.h"
#include <errno.h>
#include <stdarg.h>
#include <math.h>
@ -213,7 +214,16 @@ static void read_file_index_make_space(void) {
if (expand || gMoved >= gFIBSize) { // malloc more space
gStream.avail_out += gFIBSize;
gFIBSize *= 2;
gFileIndexBuf = realloc(gFileIndexBuf, gFIBSize);
uint8_t *new_gFileIndexBuf = realloc(gFileIndexBuf, gFIBSize);
if (new_gFileIndexBuf == NULL) {
// TODO is recovery possible? does it even make sense?
// @see https://github.com/vasi/pixz/issues/8#issuecomment-134113347
die("memory re-allocation failure: %s", strerror(errno));
} else {
gFileIndexBuf = new_gFileIndexBuf;
}
}
}

@ -1,5 +1,6 @@
TESTS = \
compress-file-permissions.sh \
cppcheck-src.sh \
single-file-round-trip.sh \
xz-compatibility-c-option.sh

@ -0,0 +1,8 @@
#!/bin/bash
if which cppcheck &> /dev/null ; then
cppcheck --error-exitcode=1 $srcdir/../src
else
echo "no cppcheck, skipping test"
exit 77
fi
Loading…
Cancel
Save