[FIX] SVACE issue #27673 00/55200/2
authorAnatolii Nikulin <nikulin.a@samsung.com>
Tue, 22 Dec 2015 10:51:41 +0000 (13:51 +0300)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Tue, 22 Dec 2015 11:01:29 +0000 (03:01 -0800)
Change-Id: If6c9d86e0c088a25015ce42e960e346541828d2e
Signed-off-by: Anatolii Nikulin <nikulin.a@samsung.com>
preload/preload_debugfs.c

index 60bfd2c..791be82 100644 (file)
@@ -252,11 +252,11 @@ static ssize_t bin_list_read(struct file *file, char __user *usr_buf,
        char *buf = NULL;
        char *ptr = NULL;
 
-       if (file->f_path.dentry == target_list)
+       if (file->f_path.dentry == target_list) {
                files_cnt = preload_control_get_target_names(&filenames);
-       else if (file->f_path.dentry == ignored_list)
+       } else if (file->f_path.dentry == ignored_list) {
                files_cnt = preload_control_get_ignored_names(&filenames);
-       else {
+       else {
                /* Should never occur */
                printk(PRELOAD_PREFIX "%s() called for invalid file %s!\n", __func__,
                       file->f_path.dentry->d_name.name);
@@ -289,26 +289,16 @@ static ssize_t bin_list_read(struct file *file, char __user *usr_buf,
                ptr += 1;
        }
 
-       if (file->f_path.dentry == target_list)
-               preload_control_release_target_names(&filenames);
-       else if (file->f_path.dentry == ignored_list)
-               preload_control_release_ignored_names(&filenames);
-       else {
-               /* Should never occur */
-               printk(PRELOAD_PREFIX "%s() called for invalid file %s!\n", __func__,
-                      file->f_path.dentry->d_name.name);
-               ret = 0;
-               goto bin_list_read_out;
-       }
+       ret = simple_read_from_buffer(usr_buf, count, ppos, buf, len);
 
-       return simple_read_from_buffer(usr_buf, count, ppos, buf, len);
+       kfree(buf);
 
 bin_list_read_fail:
-       if (file->f_path.dentry == target_list)
+       if (file->f_path.dentry == target_list) {
                preload_control_release_target_names(&filenames);
-       else if (file->f_path.dentry == ignored_list)
+       } else if (file->f_path.dentry == ignored_list)  {
                preload_control_release_ignored_names(&filenames);
-       else {
+       else {
                /* Should never occur */
                printk(PRELOAD_PREFIX "%s() called for invalid file %s!\n", __func__,
                       file->f_path.dentry->d_name.name);