浏览代码

Use asprintf(3) and avoid manual allocation

master
lostd 10 年前
父节点
当前提交
3459f6a5e7
共有 1 个文件被更改,包括 1 次插入4 次删除
  1. +1
    -4
      noice.c

+ 1
- 4
noice.c 查看文件

@@ -341,7 +341,6 @@ nochange:
}
if (ret == 3) {
char *pathnew, *pathtmp;
size_t pathsiz;
char *name;
u_int8_t type;
char *bin;
@@ -355,9 +354,7 @@ nochange:
name = dents[cur].d_name;
type = dents[cur].d_type;

pathsiz = strlen(path) + 1 + strlen(name) + 1;
pathnew = malloc(pathsiz);
snprintf(pathnew, pathsiz, "%s/%s", path, name);
asprintf(&pathnew, "%s/%s", path, name);

DPRINTF_S(name);
DPRINTF_U(type);


正在加载...
取消
保存