瀏覽代碼

Free tmp string if dirname fails

master
lostd 10 年之前
父節點
當前提交
0809871aeb
共有 1 個檔案被更改,包括 3 行新增1 行删除
  1. +3
    -1
      noice.c

+ 3
- 1
noice.c 查看文件

@@ -128,8 +128,10 @@ xdirname(const char *path)
* original string if we lose track of it. */
tmp = xstrdup(path);
p = dirname(tmp);
if (p == NULL)
if (p == NULL) {
free(tmp);
printerr(1, "dirname");
}
/* Make sure this is a malloc(3)-ed string */
p = xstrdup(p);
free(tmp);


||||||
x
 
000:0
Loading…
取消
儲存