]> arthur.barton.de Git - netatalk.git/blobdiff - bin/ad/ad_util.c
Fix ressource leak, from Riccardo Magliocchetti
[netatalk.git] / bin / ad / ad_util.c
index 8aafd667c61f947bd96f23fc2a995d02712281ed..4a8ff11b62ecee83730290246975aa2ee597fa8c 100644 (file)
@@ -274,15 +274,16 @@ cnid_t cnid_for_path(const afpvol_t *vol,
     struct bstrList *l = NULL;
     struct stat st;
 
-    *did = htonl(1);
     cnid = htonl(2);
 
     EC_NULL(rpath = rel_path_in_vol(path, vol->volinfo.v_path));
     EC_NULL(statpath = bfromcstr(vol->volinfo.v_path));
+    EC_ZERO(bcatcstr(statpath, "/"));
 
     l = bsplit(rpath, '/');
     for (int i = 0; i < l->qty ; i++) {
         *did = cnid;
+
         EC_ZERO(bconcat(statpath, l->entry[i]));
         EC_ZERO_LOGSTR(lstat(cfrombstr(statpath), &st),
                        "lstat(rpath: %s, elem: %s): %s: %s",