From 08997634797d68a84be4905574c3acc6756fe312 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Thu, 24 Feb 2011 16:34:53 +0100 Subject: [PATCH] --- yaml --- r: 236144 b: refs/heads/master c: 7ccd4506fa49600a3c59cf64608b2c9e669b6c97 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/staging/iio/Documentation/iio_utils.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 3c4c1fefa376..69950f2ee811 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2bf99c70cee1d9347145ec0d96ba39764e2193bc +refs/heads/master: 7ccd4506fa49600a3c59cf64608b2c9e669b6c97 diff --git a/trunk/drivers/staging/iio/Documentation/iio_utils.h b/trunk/drivers/staging/iio/Documentation/iio_utils.h index 4b023aa14198..bde231352a87 100644 --- a/trunk/drivers/staging/iio/Documentation/iio_utils.h +++ b/trunk/drivers/staging/iio/Documentation/iio_utils.h @@ -290,15 +290,17 @@ inline int build_channel_array(const char *device_dir, fscanf(sysfsfp, "%u", &ret); if (ret == 1) (*counter)++; + count++; fclose(sysfsfp); free(filename); } - *ci_array = malloc(sizeof(**ci_array)*(*counter)); + *ci_array = malloc(sizeof(**ci_array)*count); if (*ci_array == NULL) { ret = -ENOMEM; goto error_close_dir; } seekdir(dp, 0); + count = 0; while (ent = readdir(dp), ent != NULL) { if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), "_en") == 0) {