diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c index 74cd06924a..638b72f77b 100644 --- a/fs/procfs/fs_procfs.c +++ b/fs/procfs/fs_procfs.c @@ -421,6 +421,7 @@ static int procfs_open(FAR struct file *filep, FAR const char *relpath, static int procfs_close(FAR struct file *filep) { FAR struct procfs_file_s *attr; + int ret = OK; /* Recover our private data from the struct file instance */ @@ -429,9 +430,17 @@ static int procfs_close(FAR struct file *filep) /* Release the file attributes structure */ - kmm_free(attr); + if (attr->procfsentry->ops->close != NULL) + { + ret = attr->procfsentry->ops->close(filep); + } + else + { + kmm_free(attr); + } + filep->f_priv = NULL; - return OK; + return ret; } /****************************************************************************