Index: appfsd.c ================================================================== --- appfsd.c +++ appfsd.c @@ -757,10 +757,13 @@ pathinfo->packaged = 0; pathinfo->inode = appfs_get_path_inode(path); attr_value_str = Tcl_GetString(attr_value); + + Tcl_DecrRefCount(attr_value); + switch (attr_value_str[0]) { case 'd': /* directory */ pathinfo->type = APPFS_PATHTYPE_DIRECTORY; pathinfo->typeinfo.dir.childcount = 0; @@ -768,10 +771,12 @@ if (attr_value != NULL) { tcl_ret = Tcl_GetWideIntFromObj(NULL, attr_value, &attr_value_wide); if (tcl_ret == TCL_OK) { pathinfo->typeinfo.dir.childcount = attr_value_wide; } + + Tcl_DecrRefCount(attr_value); } break; case 'f': /* file */ pathinfo->type = APPFS_PATHTYPE_FILE; @@ -782,18 +787,22 @@ if (attr_value != NULL) { tcl_ret = Tcl_GetWideIntFromObj(NULL, attr_value, &attr_value_wide); if (tcl_ret == TCL_OK) { pathinfo->typeinfo.file.size = attr_value_wide; } + + Tcl_DecrRefCount(attr_value); } Tcl_DictObjGet(interp, attrs_dict, attr_key_perms, &attr_value); if (attr_value != NULL) { attr_value_str = Tcl_GetString(attr_value); if (attr_value_str[0] == 'x') { pathinfo->typeinfo.file.executable = 1; } + + Tcl_DecrRefCount(attr_value); } break; case 's': /* symlink */ pathinfo->type = APPFS_PATHTYPE_SYMLINK; pathinfo->typeinfo.symlink.size = 0; @@ -807,35 +816,43 @@ pathinfo->typeinfo.symlink.size = attr_value_int; pathinfo->typeinfo.symlink.source[attr_value_int] = '\0'; memcpy(pathinfo->typeinfo.symlink.source, attr_value_str, attr_value_int); } + + Tcl_DecrRefCount(attr_value); } break; case 'F': /* pipe/fifo */ pathinfo->type = APPFS_PATHTYPE_FIFO; break; case 'S': /* UNIX domain socket */ pathinfo->type = APPFS_PATHTYPE_SOCKET; break; default: + Tcl_DecrRefCount(attrs_dict); + Tcl_Release(interp); return(-EIO); } Tcl_DictObjGet(interp, attrs_dict, attr_key_packaged, &attr_value); if (attr_value != NULL) { pathinfo->packaged = 1; + + Tcl_DecrRefCount(attr_value); } Tcl_DictObjGet(interp, attrs_dict, attr_key_time, &attr_value); if (attr_value != NULL) { tcl_ret = Tcl_GetWideIntFromObj(NULL, attr_value, &attr_value_wide); if (tcl_ret == TCL_OK) { pathinfo->time = attr_value_wide; } + + Tcl_DecrRefCount(attr_value); } else { pathinfo->time = 0; } Tcl_Release(interp); @@ -1048,10 +1065,12 @@ } for (idx = 0; idx < children_count; idx++) { filler(buf, Tcl_GetString(children[idx]), NULL, 0); } + + Tcl_DecrRefCount(children); Tcl_Release(interp); return(0); }