RPA Toolkit
Fixed an edge case where the input size is 0 and the stat->instackbuffer is not alloc...
authorMartin Stoilov <martin@rpasearch.com>
Tue, 21 Jun 2011 06:58:10 +0000 (23:58 -0700)
committerMartin Stoilov <martin@rpasearch.com>
Tue, 21 Jun 2011 06:58:10 +0000 (23:58 -0700)
rpa/rpastat.c

index c0bb1e0..e43d919 100644 (file)
@@ -63,7 +63,7 @@ rinteger rpa_stat_init(rpastat_t *stat, ruinteger encoding, const rchar *input,
        stat->input = input;
        stat->cache->hit = 0;
        stat->records = records;
-       if (stat->instacksize < size) {
+       if (stat->instacksize == 0 || stat->instacksize < size) {
                stat->instackbuffer = r_realloc(stat->instackbuffer, (size + 2) * sizeof(rpainput_t));
                stat->instacksize = size;
                stat->instack = &stat->instackbuffer[1];