aboutsummaryrefslogtreecommitdiffstats
path: root/noice.c
diff options
context:
space:
mode:
authorGravatar lostd <lostd@2f30.org>2014-10-08 17:59:35 +0300
committerGravatar lostd <lostd@2f30.org>2014-10-08 17:59:35 +0300
commit3459f6a5e79b1cd248185a7562565a851cea57ab (patch)
tree6220a5c6eedab3ed3e9d993d5f8df412bc33e2b6 /noice.c
parent7028eb1838e43ec695e9a1421c264bc5e64f2ac1 (diff)
downloadnnn-3459f6a5e79b1cd248185a7562565a851cea57ab.tar.gz
Use asprintf(3) and avoid manual allocation
Diffstat (limited to 'noice.c')
-rw-r--r--noice.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/noice.c b/noice.c
index 08cc105..8874148 100644
--- a/noice.c
+++ b/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);