40 lines
1.4 KiB
Diff
40 lines
1.4 KiB
Diff
From 48641275c0cd018441685f2d3145038017f1ea42 Mon Sep 17 00:00:00 2001
|
|
From: Kamil Dudka <kdudka@redhat.com>
|
|
Date: Tue, 6 Nov 2018 16:31:32 +0100
|
|
Subject: [PATCH] tree: fix programming mistakes detected by static analysis
|
|
|
|
---
|
|
list.c | 2 +-
|
|
tree.c | 2 +-
|
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/list.c b/list.c
|
|
index 36cfbe5..c490dec 100644
|
|
--- a/list.c
|
|
+++ b/list.c
|
|
@@ -43,7 +43,7 @@ void emit_tree(char **dirname, bool needfulltree)
|
|
struct ignorefile *ig = NULL;
|
|
struct infofile *inf = NULL;
|
|
struct _info **dir = NULL, *info = NULL;
|
|
- char *err;
|
|
+ char *err = NULL;
|
|
int i, j, n, needsclosed;
|
|
struct stat st;
|
|
|
|
diff --git a/tree.c b/tree.c
|
|
index 0d51281..94aed2c 100644
|
|
--- a/tree.c
|
|
+++ b/tree.c
|
|
@@ -917,7 +917,7 @@ struct _info **unix_getfulltree(char *d, u_long lev, dev_t dev, off_t *size, cha
|
|
if (*(*dir)->lnk == '/')
|
|
(*dir)->child = unix_getfulltree((*dir)->lnk,lev+1,dev,&((*dir)->size),&((*dir)->err));
|
|
else {
|
|
- if (strlen(d)+strlen((*dir)->lnk)+2 > pathsize) path=xrealloc(path,pathsize=(strlen(d)+strlen((*dir)->name)+1024));
|
|
+ if (strlen(d)+strlen((*dir)->lnk)+2 > pathsize) path=xrealloc(path,pathsize=(strlen(d)+strlen((*dir)->lnk)+1024));
|
|
if (fflag && !strcmp(d,"/")) sprintf(path,"%s%s",d,(*dir)->lnk);
|
|
else sprintf(path,"%s/%s",d,(*dir)->lnk);
|
|
(*dir)->child = unix_getfulltree(path,lev+1,dev,&((*dir)->size),&((*dir)->err));
|
|
--
|
|
2.17.2
|
|
|