> > On Mon, Sep 26, 2016 at 09:12:48AM +0100, Frediano Ziglio wrote: > > This could have happened if mremap failed. > > If mremap fails, reds_stat will be set to MAP_FAILED, so munmap will > not be called. > > Christophe > You are right, dropped Frediano > > > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > > --- > > tools/reds_stat.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/tools/reds_stat.c b/tools/reds_stat.c > > index 945659e..d7d82ec 100644 > > --- a/tools/reds_stat.c > > +++ b/tools/reds_stat.c > > @@ -66,7 +66,7 @@ int main(int argc, char **argv) > > pid_t kvm_pid; > > uint32_t num_of_nodes = 0; > > size_t shm_size; > > - size_t shm_old_size; > > + size_t shm_new_size; > > int shm_name_len; > > int ret = -1; > > int fd; > > @@ -105,13 +105,13 @@ int main(int argc, char **argv) > > printf("spice statistics\n\n"); > > if (num_of_nodes != reds_stat->num_of_nodes) { > > num_of_nodes = reds_stat->num_of_nodes; > > - shm_old_size = shm_size; > > - shm_size = sizeof(SpiceStat) + num_of_nodes * > > sizeof(SpiceStatNode); > > - reds_stat = mremap(reds_stat, shm_old_size, shm_size, > > MREMAP_MAYMOVE); > > + shm_new_size = sizeof(SpiceStat) + num_of_nodes * > > sizeof(SpiceStatNode); > > + reds_stat = mremap(reds_stat, shm_size, shm_new_size, > > MREMAP_MAYMOVE); > > if (reds_stat == (SpiceStat *)MAP_FAILED) { > > perror("mremap"); > > goto error; > > } > > + shm_size = shm_new_size; > > values = (uint64_t *)realloc(values, num_of_nodes * > > sizeof(uint64_t)); > > if (values == NULL) { > > perror("realloc"); > > -- > > 2.7.4 > > > > _______________________________________________ > > Spice-devel mailing list > > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > > https://lists.freedesktop.org/mailman/listinfo/spice-devel > _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel