1 Star 0 Fork 11

SaltyFruit/libomxil-bellagio

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
libomxil-bellagio-0.9.3-valgrind_register.patch 2.56 KB
一键复制 编辑 原始数据 按行查看 历史
薄皮小笼包 提交于 2019-12-31 18:15 . package init
--- a/src/omxregister.c.old 2014-06-28 16:08:29.777324056 +0100
+++ b/src/omxregister.c 2014-06-28 16:08:20.960691774 +0100
@@ -76,11 +76,11 @@
long int offset;
int i;
- buffer = malloc(allocation_length+1);
- comp_name = malloc(DEFAULT_LINE_LENGHT);
- temp_name = malloc(DEFAULT_LINE_LENGHT);
- comp_rules = malloc(DEFAULT_LINE_LENGHT);
- checkChar = malloc(2);
+ buffer = calloc(allocation_length+1, sizeof(char));
+ comp_name = calloc(DEFAULT_LINE_LENGHT, sizeof(char));
+ temp_name = calloc(DEFAULT_LINE_LENGHT, sizeof(char));
+ comp_rules = calloc(DEFAULT_LINE_LENGHT, sizeof(char));
+ checkChar = calloc(2, sizeof(char));
printf("*********************************\n");
printf("* List of registered components *\n");
@@ -182,8 +182,8 @@
* and is is colon separated like env variables in Linux
*/
- qualityString = malloc(4096);
- buffer = malloc(8192);
+ qualityString = calloc(4096, sizeof(char));
+ buffer = calloc(8192, sizeof(char));
while (!pathconsumed) {
index = 0;
currentgiven = 0;
@@ -194,11 +194,11 @@
if ((*(currentpath + index) == ':') || (*(currentpath + index) =='\0')) {
currentgiven = 1;
if (*(currentpath + index - 1) != '/') {
- actual = malloc(index + 2);
+ actual = calloc(index + 2, sizeof(char));
*(actual + index) = '/';
*(actual+index + 1) = '\0';
} else {
- actual = malloc(index + 1);
+ actual = calloc(index + 1, sizeof(char));
*(actual+index) = '\0';
}
strncpy(actual, currentpath, index);
@@ -240,7 +240,7 @@
}
num_of_libraries++;
num_of_comp = fptr(NULL);
- stComponents = malloc(num_of_comp * sizeof(stLoaderComponentType*));
+ stComponents = calloc(num_of_comp, sizeof(stLoaderComponentType*));
for (i = 0; i<num_of_comp; i++) {
stComponents[i] = calloc(1,sizeof(stLoaderComponentType));
stComponents[i]->nqualitylevels = 0;
@@ -266,14 +266,14 @@
}
}
if (allNames == NULL) {
- allNames = malloc(sizeof(nameList));
+ allNames = calloc(1, sizeof(nameList));
currentName = allNames;
} else {
- currentName->next = malloc(sizeof(nameList));
+ currentName->next = calloc(1, sizeof(nameList));
currentName = currentName->next;
}
currentName->next = NULL;
- currentName->name = malloc(strlen(stComponents[i]->name) + 1);
+ currentName->name = calloc(strlen(stComponents[i]->name) + 1, sizeof(char));
strcpy(currentName->name, stComponents[i]->name);
*(currentName->name + strlen(currentName->name)) = '\0';
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/SaltyFruit/libomxil-bellagio.git
[email protected]:SaltyFruit/libomxil-bellagio.git
SaltyFruit
libomxil-bellagio
libomxil-bellagio
master

搜索帮助