Fix resource leak 43/152843/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 27 Sep 2017 08:12:46 +0000 (17:12 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 27 Sep 2017 08:12:46 +0000 (17:12 +0900)
Change-Id: I7162b23322764343629d5c6c17052670fdb5d157
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
test/appsvc_test.c

index 293601d..9b19fbb 100755 (executable)
@@ -54,24 +54,39 @@ void __set_bundle_from_args(bundle *kb)
        while ((opt = getopt(gargc, gargv, "d:o:m:u:p:c:")) != -1) {
                switch (opt) {
                case 'o':
-                       if (optarg)
+                       if (optarg) {
+                               if (op)
+                                       free(op);
                                op = strdup(optarg);
+                       }
                        break;
                case 'm':
-                       if (optarg)
+                       if (optarg) {
+                               if (mime)
+                                       free(mime);
                                mime = strdup(optarg);
+                       }
                        break;
                case 'u':
-                       if (optarg)
+                       if (optarg) {
+                               if (uri)
+                                       free(uri);
                                uri = strdup(optarg);
+                       }
                        break;
                case 'p':
-                       if (optarg)
+                       if (optarg) {
+                               if (package)
+                                       free(package);
                                package = strdup(optarg);
+                       }
                        break;
                case 'c':
-                       if (optarg)
+                       if (optarg) {
+                               if (category)
+                                       free(category);
                                category = strdup(optarg);
+                       }
                        break;
                case 'd':
                        if (optarg) {