summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLi Xiaoming <lixm.fnst@cn.fujitsu.com>2019-05-20 15:57:42 +0800
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-05-28 12:37:58 +0000
commit932a226195b3925c1b8f3d2ef11c0c7f7eb4a0ae (patch)
tree4891f58174b6f381c931da5dd2ea09ca7ccc1426 /src
parente47b4736452c263d21c4d08767071346f1f30a1c (diff)
struct stat stbuf.st_size is off_t{aka long int}, but malloc and free need size_t{aka long unsigned int}. Bug-AGL: SPEC-2422 Change-Id: I93fe49004133cd979fe24001d029a56c2660a62b Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
Diffstat (limited to 'src')
-rw-r--r--src/steering_wheel_json.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/steering_wheel_json.c b/src/steering_wheel_json.c
index 9d72284..4377a72 100644
--- a/src/steering_wheel_json.c
+++ b/src/steering_wheel_json.c
@@ -148,8 +148,8 @@ int wheel_define_init(const char *fname)
return -1;
}
- filebuf = (char *)malloc(stbuf.st_size);
- fread(filebuf, 1, stbuf.st_size, fp);
+ filebuf = (char *)malloc((size_t)stbuf.st_size);
+ fread(filebuf, 1, (size_t)stbuf.st_size, fp);
fclose(fp);
jobj = json_tokener_parse(filebuf);
@@ -274,8 +274,8 @@ int wheel_gear_para_init(const char *fname)
return -1;
}
- filebuf = (char*)malloc(stbuf.st_size);
- fread(filebuf, 1, stbuf.st_size, fp);
+ filebuf = (char*)malloc((size_t)stbuf.st_size);
+ fread(filebuf, 1, (size_t)stbuf.st_size, fp);
fclose(fp);
jobj = json_tokener_parse(filebuf);