[FIX] Us_manager: images memory deallocation 81/22381/9
authorAlexander Aksenov <a.aksenov@samsung.com>
Mon, 2 Jun 2014 13:37:33 +0000 (17:37 +0400)
committerAlexander Aksenov <a.aksenov@samsung.com>
Fri, 6 Jun 2014 07:03:39 +0000 (11:03 +0400)
Change-Id: I2a911a6926f6b2595b26b367754817ba66396dd3
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
us_manager/img/img_file.c
us_manager/img/img_proc.c

index 8802512..db5c6de 100644 (file)
@@ -28,6 +28,9 @@
 #include <linux/slab.h>
 #include <linux/dcache.h>
 
+
+static void img_del_ip_by_list(struct img_ip *ip);
+
 struct img_file *create_img_file(struct dentry *dentry)
 {
        struct img_file *file;
@@ -42,7 +45,14 @@ struct img_file *create_img_file(struct dentry *dentry)
 
 void free_img_file(struct img_file *file)
 {
-       /* FIXME: */
+       struct img_ip *ip, *tmp;
+
+       list_for_each_entry_safe(ip, tmp, &file->ip_list, list) {
+               img_del_ip_by_list(ip);
+               free_img_ip(ip);
+       }
+
+       kfree(file);
 }
 
 static void img_add_ip_by_list(struct img_file *file, struct img_ip *ip)
index 893a848..3483832 100644 (file)
@@ -27,6 +27,8 @@
 #include "img_file.h"
 #include <linux/slab.h>
 
+static void img_del_file_by_list(struct img_file *file);
+
 struct img_proc *create_img_proc(void)
 {
        struct img_proc *proc;
@@ -39,7 +41,14 @@ struct img_proc *create_img_proc(void)
 
 void free_img_proc(struct img_proc *ip)
 {
-       /* FIXME: */
+       struct img_file *file, *tmp;
+
+       list_for_each_entry_safe(file, tmp, &ip->file_list, list) {
+               img_del_file_by_list(file);
+               free_img_file(file);
+       }
+
+       kfree(ip);
 }
 
 static void img_add_file_by_list(struct img_proc *proc, struct img_file *file)