diff options
author | lostd <lostd@2f30.org> | 2014-10-08 17:59:35 +0300 |
---|---|---|
committer | lostd <lostd@2f30.org> | 2014-10-08 17:59:35 +0300 |
commit | 3459f6a5e79b1cd248185a7562565a851cea57ab (patch) | |
tree | 6220a5c6eedab3ed3e9d993d5f8df412bc33e2b6 /noice.c | |
parent | 7028eb1838e43ec695e9a1421c264bc5e64f2ac1 (diff) | |
download | nnn-3459f6a5e79b1cd248185a7562565a851cea57ab.tar.gz |
Use asprintf(3) and avoid manual allocation
Diffstat (limited to 'noice.c')
-rw-r--r-- | noice.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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); |