Parse ui-gadget attribute
[platform/core/appfw/pkgmgr-info.git] / src / pkgmgrinfo_basic.c
1 #include <stdlib.h>
2
3 #include "pkgmgrinfo_basic.h"
4 #include "pkgmgrinfo_private.h"
5
6 static void __ps_free_category(category_x *category)
7 {
8         if (category == NULL)
9                 return;
10         if (category->name) {
11                 free((void *)category->name);
12                 category->name = NULL;
13         }
14         free((void*)category);
15         category = NULL;
16 }
17
18 static void __ps_free_privilege(privilege_x *privilege)
19 {
20         if (privilege == NULL)
21                 return;
22         if (privilege->text) {
23                 free((void *)privilege->text);
24                 privilege->text = NULL;
25         }
26         free((void*)privilege);
27         privilege = NULL;
28 }
29
30 static void __ps_free_privileges(privileges_x *privileges)
31 {
32         if (privileges == NULL)
33                 return;
34         /*Free Privilege*/
35         if (privileges->privilege) {
36                 privilege_x *privilege = privileges->privilege;
37                 privilege_x *tmp = NULL;
38                 while(privilege != NULL) {
39                         tmp = privilege->next;
40                         __ps_free_privilege(privilege);
41                         privilege = tmp;
42                 }
43         }
44         free((void*)privileges);
45         privileges = NULL;
46 }
47
48 static void __ps_free_metadata(metadata_x *metadata)
49 {
50         if (metadata == NULL)
51                 return;
52         if (metadata->key) {
53                 free((void *)metadata->key);
54                 metadata->key = NULL;
55         }
56         if (metadata->value) {
57                 free((void *)metadata->value);
58                 metadata->value = NULL;
59         }
60         free((void*)metadata);
61         metadata = NULL;
62 }
63
64 static void __ps_free_permission(permission_x *permission)
65 {
66         if (permission == NULL)
67                 return;
68         if (permission->type) {
69                 free((void *)permission->type);
70                 permission->type = NULL;
71         }
72         if (permission->value) {
73                 free((void *)permission->value);
74                 permission->value = NULL;
75         }
76         free((void*)permission);
77         permission = NULL;
78 }
79
80 static void __ps_free_icon(icon_x *icon)
81 {
82         if (icon == NULL)
83                 return;
84         if (icon->text) {
85                 free((void *)icon->text);
86                 icon->text = NULL;
87         }
88         if (icon->lang) {
89                 free((void *)icon->lang);
90                 icon->lang = NULL;
91         }
92         if (icon->name) {
93                 free((void *)icon->name);
94                 icon->name= NULL;
95         }
96         if (icon->section) {
97                 free((void *)icon->section);
98                 icon->section = NULL;
99         }
100         if (icon->size) {
101                 free((void *)icon->size);
102                 icon->size = NULL;
103         }
104         if (icon->resolution) {
105                 free((void *)icon->resolution);
106                 icon->resolution = NULL;
107         }
108         free((void*)icon);
109         icon = NULL;
110 }
111
112 static void __ps_free_image(image_x *image)
113 {
114         if (image == NULL)
115                 return;
116         if (image->text) {
117                 free((void *)image->text);
118                 image->text = NULL;
119         }
120         if (image->lang) {
121                 free((void *)image->lang);
122                 image->lang = NULL;
123         }
124         if (image->name) {
125                 free((void *)image->name);
126                 image->name= NULL;
127         }
128         if (image->section) {
129                 free((void *)image->section);
130                 image->section = NULL;
131         }
132         free((void*)image);
133         image = NULL;
134 }
135
136 static void __ps_free_operation(operation_x *operation)
137 {
138         if (operation == NULL)
139                 return;
140         if (operation->text) {
141                 free((void *)operation->text);
142                 operation->text = NULL;
143         }
144         free((void*)operation);
145         operation = NULL;
146 }
147
148 static void __ps_free_uri(uri_x *uri)
149 {
150         if (uri == NULL)
151                 return;
152         if (uri->text) {
153                 free((void *)uri->text);
154                 uri->text = NULL;
155         }
156         free((void*)uri);
157         uri = NULL;
158 }
159
160 static void __ps_free_mime(mime_x *mime)
161 {
162         if (mime == NULL)
163                 return;
164         if (mime->text) {
165                 free((void *)mime->text);
166                 mime->text = NULL;
167         }
168         free((void*)mime);
169         mime = NULL;
170 }
171
172 static void __ps_free_subapp(subapp_x *subapp)
173 {
174         if (subapp == NULL)
175                 return;
176         if (subapp->text) {
177                 free((void *)subapp->text);
178                 subapp->text = NULL;
179         }
180         free((void*)subapp);
181         subapp = NULL;
182 }
183
184 static void __ps_free_condition(condition_x *condition)
185 {
186         if (condition == NULL)
187                 return;
188         if (condition->text) {
189                 free((void *)condition->text);
190                 condition->text = NULL;
191         }
192         if (condition->name) {
193                 free((void *)condition->name);
194                 condition->name = NULL;
195         }
196         free((void*)condition);
197         condition = NULL;
198 }
199
200 static void __ps_free_notification(notification_x *notification)
201 {
202         if (notification == NULL)
203                 return;
204         if (notification->text) {
205                 free((void *)notification->text);
206                 notification->text = NULL;
207         }
208         if (notification->name) {
209                 free((void *)notification->name);
210                 notification->name = NULL;
211         }
212         free((void*)notification);
213         notification = NULL;
214 }
215
216 static void __ps_free_compatibility(compatibility_x *compatibility)
217 {
218         if (compatibility == NULL)
219                 return;
220         if (compatibility->text) {
221                 free((void *)compatibility->text);
222                 compatibility->text = NULL;
223         }
224         if (compatibility->name) {
225                 free((void *)compatibility->name);
226                 compatibility->name = NULL;
227         }
228         free((void*)compatibility);
229         compatibility = NULL;
230 }
231
232 static void __ps_free_allowed(allowed_x *allowed)
233 {
234         if (allowed == NULL)
235                 return;
236         if (allowed->name) {
237                 free((void *)allowed->name);
238                 allowed->name = NULL;
239         }
240         if (allowed->text) {
241                 free((void *)allowed->text);
242                 allowed->text = NULL;
243         }
244         free((void*)allowed);
245         allowed = NULL;
246 }
247
248 static void __ps_free_request(request_x *request)
249 {
250         if (request == NULL)
251                 return;
252         if (request->text) {
253                 free((void *)request->text);
254                 request->text = NULL;
255         }
256         free((void*)request);
257         request = NULL;
258 }
259
260 static void __ps_free_datacontrol(datacontrol_x *datacontrol)
261 {
262         if (datacontrol == NULL)
263                 return;
264         if (datacontrol->providerid) {
265                 free((void *)datacontrol->providerid);
266                 datacontrol->providerid = NULL;
267         }
268         if (datacontrol->access) {
269                 free((void *)datacontrol->access);
270                 datacontrol->access = NULL;
271         }
272         if (datacontrol->type) {
273                 free((void *)datacontrol->type);
274                 datacontrol->type = NULL;
275         }
276         free((void*)datacontrol);
277         datacontrol = NULL;
278 }
279
280 static void __ps_free_launchconditions(launchconditions_x *launchconditions)
281 {
282         if (launchconditions == NULL)
283                 return;
284         if (launchconditions->text) {
285                 free((void *)launchconditions->text);
286                 launchconditions->text = NULL;
287         }
288         /*Free Condition*/
289         if (launchconditions->condition) {
290                 condition_x *condition = launchconditions->condition;
291                 condition_x *tmp = NULL;
292                 while(condition != NULL) {
293                         tmp = condition->next;
294                         __ps_free_condition(condition);
295                         condition = tmp;
296                 }
297         }
298         free((void*)launchconditions);
299         launchconditions = NULL;
300 }
301
302 static void __ps_free_appcontrol(appcontrol_x *appcontrol)
303 {
304         if (appcontrol == NULL)
305                 return;
306         /*Free Operation*/
307         if (appcontrol->operation)
308                 free((void *)appcontrol->operation);
309         /*Free Uri*/
310         if (appcontrol->uri)
311                 free((void *)appcontrol->uri);
312         /*Free Mime*/
313         if (appcontrol->mime)
314                 free((void *)appcontrol->mime);
315         free((void*)appcontrol);
316         appcontrol = NULL;
317 }
318
319 static void __ps_free_appsvc(appsvc_x *appsvc)
320 {
321         if (appsvc == NULL)
322                 return;
323         if (appsvc->text) {
324                 free((void *)appsvc->text);
325                 appsvc->text = NULL;
326         }
327         /*Free Operation*/
328         if (appsvc->operation) {
329                 operation_x *operation = appsvc->operation;
330                 operation_x *tmp = NULL;
331                 while(operation != NULL) {
332                         tmp = operation->next;
333                         __ps_free_operation(operation);
334                         operation = tmp;
335                 }
336         }
337         /*Free Uri*/
338         if (appsvc->uri) {
339                 uri_x *uri = appsvc->uri;
340                 uri_x *tmp = NULL;
341                 while(uri != NULL) {
342                         tmp = uri->next;
343                         __ps_free_uri(uri);
344                         uri = tmp;
345                 }
346         }
347         /*Free Mime*/
348         if (appsvc->mime) {
349                 mime_x *mime = appsvc->mime;
350                 mime_x *tmp = NULL;
351                 while(mime != NULL) {
352                         tmp = mime->next;
353                         __ps_free_mime(mime);
354                         mime = tmp;
355                 }
356         }
357         /*Free subapp*/
358         if (appsvc->subapp) {
359                 subapp_x *subapp = appsvc->subapp;
360                 subapp_x *tmp = NULL;
361                 while(subapp != NULL) {
362                         tmp = subapp->next;
363                         __ps_free_subapp(subapp);
364                         subapp = tmp;
365                 }
366         }
367         free((void*)appsvc);
368         appsvc = NULL;
369 }
370
371 static void __ps_free_deviceprofile(deviceprofile_x *deviceprofile)
372 {
373         return;
374 }
375
376 static void __ps_free_define(define_x *define)
377 {
378         if (define == NULL)
379                 return;
380         if (define->path) {
381                 free((void *)define->path);
382                 define->path = NULL;
383         }
384         /*Free Request*/
385         if (define->request) {
386                 request_x *request = define->request;
387                 request_x *tmp = NULL;
388                 while(request != NULL) {
389                         tmp = request->next;
390                         __ps_free_request(request);
391                         request = tmp;
392                 }
393         }
394         /*Free Allowed*/
395         if (define->allowed) {
396                 allowed_x *allowed = define->allowed;
397                 allowed_x *tmp = NULL;
398                 while(allowed != NULL) {
399                         tmp = allowed->next;
400                         __ps_free_allowed(allowed);
401                         allowed = tmp;
402                 }
403         }
404         free((void*)define);
405         define = NULL;
406 }
407
408 static void __ps_free_datashare(datashare_x *datashare)
409 {
410         if (datashare == NULL)
411                 return;
412         /*Free Define*/
413         if (datashare->define) {
414                 define_x *define =  datashare->define;
415                 define_x *tmp = NULL;
416                 while(define != NULL) {
417                         tmp = define->next;
418                         __ps_free_define(define);
419                         define = tmp;
420                 }
421         }
422         /*Free Request*/
423         if (datashare->request) {
424                 request_x *request = datashare->request;
425                 request_x *tmp = NULL;
426                 while(request != NULL) {
427                         tmp = request->next;
428                         __ps_free_request(request);
429                         request = tmp;
430                 }
431         }
432         free((void*)datashare);
433         datashare = NULL;
434 }
435
436 static void __ps_free_label(label_x *label)
437 {
438         if (label == NULL)
439                 return;
440         if (label->name) {
441                 free((void *)label->name);
442                 label->name = NULL;
443         }
444         if (label->text) {
445                 free((void *)label->text);
446                 label->text = NULL;
447         }
448         if (label->lang) {
449                 free((void *)label->lang);
450                 label->lang= NULL;
451         }
452         free((void*)label);
453         label = NULL;
454 }
455
456 static void __ps_free_author(author_x *author)
457 {
458         if (author == NULL)
459                 return;
460         if (author->email) {
461                 free((void *)author->email);
462                 author->email = NULL;
463         }
464         if (author->text) {
465                 free((void *)author->text);
466                 author->text = NULL;
467         }
468         if (author->href) {
469                 free((void *)author->href);
470                 author->href = NULL;
471         }
472         if (author->lang) {
473                 free((void *)author->lang);
474                 author->lang = NULL;
475         }
476         free((void*)author);
477         author = NULL;
478 }
479
480 static void __ps_free_description(description_x *description)
481 {
482         if (description == NULL)
483                 return;
484         if (description->name) {
485                 free((void *)description->name);
486                 description->name = NULL;
487         }
488         if (description->text) {
489                 free((void *)description->text);
490                 description->text = NULL;
491         }
492         if (description->lang) {
493                 free((void *)description->lang);
494                 description->lang = NULL;
495         }
496         free((void*)description);
497         description = NULL;
498 }
499
500 static void __ps_free_license(license_x *license)
501 {
502         if (license == NULL)
503                 return;
504         if (license->text) {
505                 free((void *)license->text);
506                 license->text = NULL;
507         }
508         if (license->lang) {
509                 free((void *)license->lang);
510                 license->lang = NULL;
511         }
512         free((void*)license);
513         license = NULL;
514 }
515
516 static void __ps_free_uiapplication(uiapplication_x *uiapplication)
517 {
518         if (uiapplication == NULL)
519                 return;
520         if (uiapplication->exec) {
521                 free((void *)uiapplication->exec);
522                 uiapplication->exec = NULL;
523         }
524         if (uiapplication->appid) {
525                 free((void *)uiapplication->appid);
526                 uiapplication->appid = NULL;
527         }
528         if (uiapplication->nodisplay) {
529                 free((void *)uiapplication->nodisplay);
530                 uiapplication->nodisplay = NULL;
531         }
532         if (uiapplication->multiple) {
533                 free((void *)uiapplication->multiple);
534                 uiapplication->multiple = NULL;
535         }
536         if (uiapplication->type) {
537                 free((void *)uiapplication->type);
538                 uiapplication->type = NULL;
539         }
540         if (uiapplication->categories) {
541                 free((void *)uiapplication->categories);
542                 uiapplication->categories = NULL;
543         }
544         if (uiapplication->extraid) {
545                 free((void *)uiapplication->extraid);
546                 uiapplication->extraid = NULL;
547         }
548         if (uiapplication->taskmanage) {
549                 free((void *)uiapplication->taskmanage);
550                 uiapplication->taskmanage = NULL;
551         }
552         if (uiapplication->enabled) {
553                 free((void *)uiapplication->enabled);
554                 uiapplication->enabled = NULL;
555         }
556         if (uiapplication->hwacceleration) {
557                 free((void *)uiapplication->hwacceleration);
558                 uiapplication->hwacceleration = NULL;
559         }
560         if (uiapplication->screenreader) {
561                 free((void *)uiapplication->screenreader);
562                 uiapplication->screenreader = NULL;
563         }
564         if (uiapplication->mainapp) {
565                 free((void *)uiapplication->mainapp);
566                 uiapplication->mainapp = NULL;
567         }
568         if (uiapplication->recentimage) {
569                 free((void *)uiapplication->recentimage);
570                 uiapplication->recentimage = NULL;
571         }
572         if (uiapplication->package) {
573                 free((void *)uiapplication->package);
574                 uiapplication->package = NULL;
575         }
576         if (uiapplication->launchcondition) {
577                 free((void *)uiapplication->launchcondition);
578                 uiapplication->launchcondition = NULL;
579         }
580         /*Free Label*/
581         if (uiapplication->label) {
582                 label_x *label = uiapplication->label;
583                 label_x *tmp = NULL;
584                 while(label != NULL) {
585                         tmp = label->next;
586                         __ps_free_label(label);
587                         label = tmp;
588                 }
589         }
590         /*Free Icon*/
591         if (uiapplication->icon) {
592                 icon_x *icon = uiapplication->icon;
593                 icon_x *tmp = NULL;
594                 while(icon != NULL) {
595                         tmp = icon->next;
596                         __ps_free_icon(icon);
597                         icon = tmp;
598                 }
599         }
600         /*Free image*/
601         if (uiapplication->image) {
602                 image_x *image = uiapplication->image;
603                 image_x *tmp = NULL;
604                 while(image != NULL) {
605                         tmp = image->next;
606                         __ps_free_image(image);
607                         image = tmp;
608                 }
609         }
610         /*Free AppControl*/
611         if (uiapplication->appcontrol) {
612                 appcontrol_x *appcontrol = uiapplication->appcontrol;
613                 appcontrol_x *tmp = NULL;
614                 while(appcontrol != NULL) {
615                         tmp = appcontrol->next;
616                         __ps_free_appcontrol(appcontrol);
617                         appcontrol = tmp;
618                 }
619         }
620         /*Free LaunchConditions*/
621         if (uiapplication->launchconditions) {
622                 launchconditions_x *launchconditions = uiapplication->launchconditions;
623                 launchconditions_x *tmp = NULL;
624                 while(launchconditions != NULL) {
625                         tmp = launchconditions->next;
626                         __ps_free_launchconditions(launchconditions);
627                         launchconditions = tmp;
628                 }
629         }
630         /*Free Notification*/
631         if (uiapplication->notification) {
632                 notification_x *notification = uiapplication->notification;
633                 notification_x *tmp = NULL;
634                 while(notification != NULL) {
635                         tmp = notification->next;
636                         __ps_free_notification(notification);
637                         notification = tmp;
638                 }
639         }
640         /*Free DataShare*/
641         if (uiapplication->datashare) {
642                 datashare_x *datashare = uiapplication->datashare;
643                 datashare_x *tmp = NULL;
644                 while(datashare != NULL) {
645                         tmp = datashare->next;
646                         __ps_free_datashare(datashare);
647                         datashare = tmp;
648                 }
649         }
650         /*Free AppSvc*/
651         if (uiapplication->appsvc) {
652                 appsvc_x *appsvc = uiapplication->appsvc;
653                 appsvc_x *tmp = NULL;
654                 while(appsvc != NULL) {
655                         tmp = appsvc->next;
656                         __ps_free_appsvc(appsvc);
657                         appsvc = tmp;
658                 }
659         }
660         /*Free Category*/
661         if (uiapplication->category) {
662                 category_x *category = uiapplication->category;
663                 category_x *tmp = NULL;
664                 while(category != NULL) {
665                         tmp = category->next;
666                         __ps_free_category(category);
667                         category = tmp;
668                 }
669         }
670         /*Free Metadata*/
671         if (uiapplication->metadata) {
672                 metadata_x *metadata = uiapplication->metadata;
673                 metadata_x *tmp = NULL;
674                 while(metadata != NULL) {
675                         tmp = metadata->next;
676                         __ps_free_metadata(metadata);
677                         metadata = tmp;
678                 }
679         }
680         /*Free permission*/
681         if (uiapplication->permission) {
682                 permission_x *permission = uiapplication->permission;
683                 permission_x *tmp = NULL;
684                 while(permission != NULL) {
685                         tmp = permission->next;
686                         __ps_free_permission(permission);
687                         permission = tmp;
688                 }
689         }
690         /*Free DataControl*/
691         if (uiapplication->datacontrol) {
692                 datacontrol_x *datacontrol = uiapplication->datacontrol;
693                 datacontrol_x *tmp = NULL;
694                 while(datacontrol != NULL) {
695                         tmp = datacontrol->next;
696                         __ps_free_datacontrol(datacontrol);
697                         datacontrol = tmp;
698                 }
699         }
700         /* _PRODUCT_LAUNCHING_ENHANCED_ START */
701         if (uiapplication->indicatordisplay) {
702                 free((void *)uiapplication->indicatordisplay);
703                 uiapplication->indicatordisplay = NULL;
704         }
705         if (uiapplication->portraitimg) {
706                 free((void *)uiapplication->portraitimg);
707                 uiapplication->portraitimg = NULL;
708         }
709         if (uiapplication->landscapeimg) {
710                 free((void *)uiapplication->landscapeimg);
711                 uiapplication->landscapeimg = NULL;
712         }
713         /* _PRODUCT_LAUNCHING_ENHANCED_ END */
714         if (uiapplication->guestmode_visibility) {
715                 free((void *)uiapplication->guestmode_visibility);
716                 uiapplication->guestmode_visibility = NULL;
717         }
718         if (uiapplication->app_component) {
719                 free((void *)uiapplication->app_component);
720                 uiapplication->app_component = NULL;
721         }
722         if (uiapplication->permission_type) {
723                 free((void *)uiapplication->permission_type);
724                 uiapplication->permission_type = NULL;
725         }
726         if (uiapplication->component_type) {
727                 free((void *)uiapplication->component_type);
728                 uiapplication->component_type = NULL;
729         }
730         if (uiapplication->preload) {
731                 free((void *)uiapplication->preload);
732                 uiapplication->preload = NULL;
733         }
734         if (uiapplication->submode) {
735                 free((void *)uiapplication->submode);
736                 uiapplication->submode = NULL;
737         }
738         if (uiapplication->submode_mainid) {
739                 free((void *)uiapplication->submode_mainid);
740                 uiapplication->submode_mainid = NULL;
741         }
742         if (uiapplication->ui_gadget) {
743                 free((void *)uiapplication->ui_gadget);
744                 uiapplication->ui_gadget = NULL;
745         }
746
747         free((void*)uiapplication);
748         uiapplication = NULL;
749 }
750
751 static void __ps_free_serviceapplication(serviceapplication_x *serviceapplication)
752 {
753         if (serviceapplication == NULL)
754                 return;
755         if (serviceapplication->exec) {
756                 free((void *)serviceapplication->exec);
757                 serviceapplication->exec = NULL;
758         }
759         if (serviceapplication->appid) {
760                 free((void *)serviceapplication->appid);
761                 serviceapplication->appid = NULL;
762         }
763         if (serviceapplication->onboot) {
764                 free((void *)serviceapplication->onboot);
765                 serviceapplication->onboot = NULL;
766         }
767         if (serviceapplication->autorestart) {
768                 free((void *)serviceapplication->autorestart);
769                 serviceapplication->autorestart = NULL;
770         }
771         if (serviceapplication->type) {
772                 free((void *)serviceapplication->type);
773                 serviceapplication->type = NULL;
774         }
775         if (serviceapplication->enabled) {
776                 free((void *)serviceapplication->enabled);
777                 serviceapplication->enabled = NULL;
778         }
779         if (serviceapplication->package) {
780                 free((void *)serviceapplication->package);
781                 serviceapplication->package = NULL;
782         }
783         if (serviceapplication->permission_type) {
784                 free((void *)serviceapplication->permission_type);
785                 serviceapplication->permission_type = NULL;
786         }
787         /*Free Label*/
788         if (serviceapplication->label) {
789                 label_x *label = serviceapplication->label;
790                 label_x *tmp = NULL;
791                 while(label != NULL) {
792                         tmp = label->next;
793                         __ps_free_label(label);
794                         label = tmp;
795                 }
796         }
797         /*Free Icon*/
798         if (serviceapplication->icon) {
799                 icon_x *icon = serviceapplication->icon;
800                 icon_x *tmp = NULL;
801                 while(icon != NULL) {
802                         tmp = icon->next;
803                         __ps_free_icon(icon);
804                         icon = tmp;
805                 }
806         }
807         /*Free AppControl*/
808         if (serviceapplication->appcontrol) {
809                 appcontrol_x *appcontrol = serviceapplication->appcontrol;
810                 appcontrol_x *tmp = NULL;
811                 while(appcontrol != NULL) {
812                         tmp = appcontrol->next;
813                         __ps_free_appcontrol(appcontrol);
814                         appcontrol = tmp;
815                 }
816         }
817         /*Free DataControl*/
818         if (serviceapplication->datacontrol) {
819                 datacontrol_x *datacontrol = serviceapplication->datacontrol;
820                 datacontrol_x *tmp = NULL;
821                 while(datacontrol != NULL) {
822                         tmp = datacontrol->next;
823                         __ps_free_datacontrol(datacontrol);
824                         datacontrol = tmp;
825                 }
826         }
827         /*Free LaunchConditions*/
828         if (serviceapplication->launchconditions) {
829                 launchconditions_x *launchconditions = serviceapplication->launchconditions;
830                 launchconditions_x *tmp = NULL;
831                 while(launchconditions != NULL) {
832                         tmp = launchconditions->next;
833                         __ps_free_launchconditions(launchconditions);
834                         launchconditions = tmp;
835                 }
836         }
837         /*Free Notification*/
838         if (serviceapplication->notification) {
839                 notification_x *notification = serviceapplication->notification;
840                 notification_x *tmp = NULL;
841                 while(notification != NULL) {
842                         tmp = notification->next;
843                         __ps_free_notification(notification);
844                         notification = tmp;
845                 }
846         }
847         /*Free DataShare*/
848         if (serviceapplication->datashare) {
849                 datashare_x *datashare = serviceapplication->datashare;
850                 datashare_x *tmp = NULL;
851                 while(datashare != NULL) {
852                         tmp = datashare->next;
853                         __ps_free_datashare(datashare);
854                         datashare = tmp;
855                 }
856         }
857         /*Free AppSvc*/
858         if (serviceapplication->appsvc) {
859                 appsvc_x *appsvc = serviceapplication->appsvc;
860                 appsvc_x *tmp = NULL;
861                 while(appsvc != NULL) {
862                         tmp = appsvc->next;
863                         __ps_free_appsvc(appsvc);
864                         appsvc = tmp;
865                 }
866         }
867         /*Free Category*/
868         if (serviceapplication->category) {
869                 category_x *category = serviceapplication->category;
870                 category_x *tmp = NULL;
871                 while(category != NULL) {
872                         tmp = category->next;
873                         __ps_free_category(category);
874                         category = tmp;
875                 }
876         }
877         /*Free Metadata*/
878         if (serviceapplication->metadata) {
879                 metadata_x *metadata = serviceapplication->metadata;
880                 metadata_x *tmp = NULL;
881                 while(metadata != NULL) {
882                         tmp = metadata->next;
883                         __ps_free_metadata(metadata);
884                         metadata = tmp;
885                 }
886         }
887         /*Free permission*/
888         if (serviceapplication->permission) {
889                 permission_x *permission = serviceapplication->permission;
890                 permission_x *tmp = NULL;
891                 while(permission != NULL) {
892                         tmp = permission->next;
893                         __ps_free_permission(permission);
894                         permission = tmp;
895                 }
896         }
897         free((void*)serviceapplication);
898         serviceapplication = NULL;
899 }
900
901 static void __ps_free_font(font_x *font)
902 {
903         if (font == NULL)
904                 return;
905         if (font->name) {
906                 free((void *)font->name);
907                 font->name = NULL;
908         }
909         if (font->text) {
910                 free((void *)font->text);
911                 font->text = NULL;
912         }
913         free((void*)font);
914         font = NULL;
915 }
916
917 static void __ps_free_theme(theme_x *theme)
918 {
919         if (theme == NULL)
920                 return;
921         if (theme->name) {
922                 free((void *)theme->name);
923                 theme->name = NULL;
924         }
925         if (theme->text) {
926                 free((void *)theme->text);
927                 theme->text = NULL;
928         }
929         free((void*)theme);
930         theme = NULL;
931 }
932
933 static void __ps_free_daemon(daemon_x *daemon)
934 {
935         if (daemon == NULL)
936                 return;
937         if (daemon->name) {
938                 free((void *)daemon->name);
939                 daemon->name = NULL;
940         }
941         if (daemon->text) {
942                 free((void *)daemon->text);
943                 daemon->text = NULL;
944         }
945         free((void*)daemon);
946         daemon = NULL;
947 }
948
949 static void __ps_free_ime(ime_x *ime)
950 {
951         if (ime == NULL)
952                 return;
953         if (ime->name) {
954                 free((void *)ime->name);
955                 ime->name = NULL;
956         }
957         if (ime->text) {
958                 free((void *)ime->text);
959                 ime->text = NULL;
960         }
961         free((void*)ime);
962         ime = NULL;
963 }
964
965 API void pkgmgrinfo_basic_free_application(application_x *application)
966 {
967         if (application == NULL)
968                 return;
969
970         if (application->appid)
971                 free((void *)application->appid);
972         if (application->component)
973                 free((void *)application->component);
974         if (application->exec)
975                 free((void *)application->exec);
976         if (application->nodisplay)
977                 free((void *)application->nodisplay);
978         if (application->type)
979                 free((void *)application->type);
980         if (application->onboot)
981                 free((void *)application->onboot);
982         if (application->multiple)
983                 free((void *)application->multiple);
984         if (application->autorestart)
985                 free((void *)application->autorestart);
986         if (application->taskmanage)
987                 free((void *)application->taskmanage);
988         if (application->enabled)
989                 free((void *)application->enabled);
990         if (application->hwacceleration)
991                 free((void *)application->hwacceleration);
992         if (application->screenreader)
993                 free((void *)application->screenreader);
994         if (application->mainapp)
995                 free((void *)application->mainapp);
996         if (application->recentimage)
997                 free((void *)application->recentimage);
998         if (application->launchcondition)
999                 free((void *)application->launchcondition);
1000         if (application->indicatordisplay)
1001                 free((void *)application->indicatordisplay);
1002         if (application->portraitimg)
1003                 free((void *)application->portraitimg);
1004         if (application->landscapeimg)
1005                 free((void *)application->landscapeimg);
1006         if (application->guestmode_visibility)
1007                 free((void *)application->guestmode_visibility);
1008         if (application->permission_type)
1009                 free((void *)application->permission_type);
1010         if (application->preload)
1011                 free((void *)application->preload);
1012         if (application->submode)
1013                 free((void *)application->submode);
1014         if (application->submode_mainid)
1015                 free((void *)application->submode_mainid);
1016         if (application->launch_mode)
1017                 free((void *)application->launch_mode);
1018         if (application->ui_gadget)
1019                 free((void *)application->ui_gadget);
1020         if (application->component_type)
1021                 free((void *)application->component_type);
1022         if (application->package)
1023                 free((void *)application->package);
1024
1025         /*Free Label*/
1026         if (application->label) {
1027                 label_x *label = application->label;
1028                 label_x *tmp = NULL;
1029                 while(label != NULL) {
1030                         tmp = label->next;
1031                         __ps_free_label(label);
1032                         label = tmp;
1033                 }
1034         }
1035         /*Free Icon*/
1036         if (application->icon) {
1037                 icon_x *icon = application->icon;
1038                 icon_x *tmp = NULL;
1039                 while(icon != NULL) {
1040                         tmp = icon->next;
1041                         __ps_free_icon(icon);
1042                         icon = tmp;
1043                 }
1044         }
1045         /*Free image*/
1046         if (application->image) {
1047                 image_x *image = application->image;
1048                 image_x *tmp = NULL;
1049                 while(image != NULL) {
1050                         tmp = image->next;
1051                         __ps_free_image(image);
1052                         image = tmp;
1053                 }
1054         }
1055         /*Free AppSvc*/
1056         if (application->appsvc) {
1057                 appsvc_x *appsvc = application->appsvc;
1058                 appsvc_x *tmp = NULL;
1059                 while(appsvc != NULL) {
1060                         tmp = appsvc->next;
1061                         __ps_free_appsvc(appsvc);
1062                         appsvc = tmp;
1063                 }
1064         }
1065         /*Free AppControl*/
1066         if (application->appcontrol) {
1067                 appcontrol_x *appcontrol = application->appcontrol;
1068                 appcontrol_x *tmp = NULL;
1069                 while(appcontrol != NULL) {
1070                         tmp = appcontrol->next;
1071                         __ps_free_appcontrol(appcontrol);
1072                         appcontrol = tmp;
1073                 }
1074         }
1075         /*Free Category*/
1076         if (application->category) {
1077                 category_x *category = application->category;
1078                 category_x *tmp = NULL;
1079                 while(category != NULL) {
1080                         tmp = category->next;
1081                         __ps_free_category(category);
1082                         category = tmp;
1083                 }
1084         }
1085         /*Free Metadata*/
1086         if (application->metadata) {
1087                 metadata_x *metadata = application->metadata;
1088                 metadata_x *tmp = NULL;
1089                 while(metadata != NULL) {
1090                         tmp = metadata->next;
1091                         __ps_free_metadata(metadata);
1092                         metadata = tmp;
1093                 }
1094         }
1095         /*Free permission*/
1096         if (application->permission) {
1097                 permission_x *permission = application->permission;
1098                 permission_x *tmp = NULL;
1099                 while(permission != NULL) {
1100                         tmp = permission->next;
1101                         __ps_free_permission(permission);
1102                         permission = tmp;
1103                 }
1104         }
1105         /*Free LaunchConditions*/
1106         if (application->launchconditions) {
1107                 launchconditions_x *launchconditions = application->launchconditions;
1108                 launchconditions_x *tmp = NULL;
1109                 while(launchconditions != NULL) {
1110                         tmp = launchconditions->next;
1111                         __ps_free_launchconditions(launchconditions);
1112                         launchconditions = tmp;
1113                 }
1114         }
1115         /*Free Notification*/
1116         if (application->notification) {
1117                 notification_x *notification = application->notification;
1118                 notification_x *tmp = NULL;
1119                 while(notification != NULL) {
1120                         tmp = notification->next;
1121                         __ps_free_notification(notification);
1122                         notification = tmp;
1123                 }
1124         }
1125         /*Free DataShare*/
1126         if (application->datashare) {
1127                 datashare_x *datashare = application->datashare;
1128                 datashare_x *tmp = NULL;
1129                 while(datashare != NULL) {
1130                         tmp = datashare->next;
1131                         __ps_free_datashare(datashare);
1132                         datashare = tmp;
1133                 }
1134         }
1135         /*Free DataControl*/
1136         if (application->datacontrol) {
1137                 datacontrol_x *datacontrol = application->datacontrol;
1138                 datacontrol_x *tmp = NULL;
1139                 while(datacontrol != NULL) {
1140                         tmp = datacontrol->next;
1141                         __ps_free_datacontrol(datacontrol);
1142                         datacontrol = tmp;
1143                 }
1144         }
1145         free((void *)application);
1146 }
1147
1148 API void pkgmgrinfo_basic_free_package(package_x *package)
1149 {
1150         if (package == NULL)
1151                 return;
1152         if (package->for_all_users) {
1153                 free((void *)package->for_all_users);
1154                 package->for_all_users = NULL;
1155         }
1156         if (package->ns) {
1157                 free((void *)package->ns);
1158                 package->ns = NULL;
1159         }
1160         if (package->package) {
1161                 free((void *)package->package);
1162                 package->package = NULL;
1163         }
1164         if (package->version) {
1165                 free((void *)package->version);
1166                 package->version = NULL;
1167         }
1168         if (package->installlocation) {
1169                 free((void *)package->installlocation);
1170                 package->installlocation = NULL;
1171         }
1172         if (package->preload) {
1173                 free((void *)package->preload);
1174                 package->preload = NULL;
1175         }
1176         if (package->readonly) {
1177                 free((void *)package->readonly);
1178                 package->readonly = NULL;
1179         }
1180         if (package->removable) {
1181                 free((void *)package->removable);
1182                 package->removable = NULL;
1183         }
1184         if (package->update) {
1185                 free((void *)package->update);
1186                 package->update = NULL;
1187         }
1188         if (package->system) {
1189                 free((void *)package->system);
1190                 package->system = NULL;
1191         }
1192         if (package->type) {
1193                 free((void *)package->type);
1194                 package->type = NULL;
1195         }
1196         if (package->package_size) {
1197                 free((void *)package->package_size);
1198                 package->package_size = NULL;
1199         }
1200         if (package->installed_time) {
1201                 free((void *)package->installed_time);
1202                 package->installed_time = NULL;
1203         }
1204         if (package->installed_storage) {
1205                 free((void *)package->installed_storage);
1206                 package->installed_storage = NULL;
1207         }
1208         if (package->storeclient_id) {
1209                 free((void *)package->storeclient_id);
1210                 package->storeclient_id = NULL;
1211         }
1212         if (package->mainapp_id) {
1213                 free((void *)package->mainapp_id);
1214                 package->mainapp_id = NULL;
1215         }
1216         if (package->package_url) {
1217                 free((void *)package->package_url);
1218                 package->package_url = NULL;
1219         }
1220         if (package->root_path) {
1221                 free((void *)package->root_path);
1222                 package->root_path = NULL;
1223         }
1224         if (package->csc_path) {
1225                 free((void *)package->csc_path);
1226                 package->csc_path = NULL;
1227         }
1228         if (package->appsetting) {
1229                 free((void *)package->appsetting);
1230                 package->appsetting = NULL;
1231         }
1232         if (package->nodisplay_setting) {
1233                 free((void *)package->nodisplay_setting);
1234                 package->nodisplay_setting = NULL;
1235         }
1236         if (package->api_version) {
1237                 free((void *)package->api_version);
1238                 package->api_version = NULL;
1239         }
1240
1241         /*Free Icon*/
1242         if (package->icon) {
1243                 icon_x *icon = package->icon;
1244                 icon_x *tmp = NULL;
1245                 while(icon != NULL) {
1246                         tmp = icon->next;
1247                         __ps_free_icon(icon);
1248                         icon = tmp;
1249                 }
1250         }
1251         /*Free Label*/
1252         if (package->label) {
1253                 label_x *label = package->label;
1254                 label_x *tmp = NULL;
1255                 while(label != NULL) {
1256                         tmp = label->next;
1257                         __ps_free_label(label);
1258                         label = tmp;
1259                 }
1260         }
1261         /*Free Author*/
1262         if (package->author) {
1263                 author_x *author = package->author;
1264                 author_x *tmp = NULL;
1265                 while(author != NULL) {
1266                         tmp = author->next;
1267                         __ps_free_author(author);
1268                         author = tmp;
1269                 }
1270         }
1271         /*Free Description*/
1272         if (package->description) {
1273                 description_x *description = package->description;
1274                 description_x *tmp = NULL;
1275                 while(description != NULL) {
1276                         tmp = description->next;
1277                         __ps_free_description(description);
1278                         description = tmp;
1279                 }
1280         }
1281         /*Free License*/
1282         if (package->license) {
1283                 license_x *license = package->license;
1284                 license_x *tmp = NULL;
1285                 while(license != NULL) {
1286                         tmp = license->next;
1287                         __ps_free_license(license);
1288                         license = tmp;
1289                 }
1290         }
1291         /*Free Privileges*/
1292         if (package->privileges) {
1293                 privileges_x *privileges = package->privileges;
1294                 privileges_x *tmp = NULL;
1295                 while(privileges != NULL) {
1296                         tmp = privileges->next;
1297                         __ps_free_privileges(privileges);
1298                         privileges = tmp;
1299                 }
1300         }
1301         /*Free UiApplication*/
1302         if (package->uiapplication) {
1303                 uiapplication_x *uiapplication = package->uiapplication;
1304                 uiapplication_x *tmp = NULL;
1305                 while(uiapplication != NULL) {
1306                         tmp = uiapplication->next;
1307                         __ps_free_uiapplication(uiapplication);
1308                         uiapplication = tmp;
1309                 }
1310         }
1311         /*Free ServiceApplication*/
1312         if (package->serviceapplication) {
1313                 serviceapplication_x *serviceapplication = package->serviceapplication;
1314                 serviceapplication_x *tmp = NULL;
1315                 while(serviceapplication != NULL) {
1316                         tmp = serviceapplication->next;
1317                         __ps_free_serviceapplication(serviceapplication);
1318                         serviceapplication = tmp;
1319                 }
1320         }
1321         /*Free Daemon*/
1322         if (package->daemon) {
1323                 daemon_x *daemon = package->daemon;
1324                 daemon_x *tmp = NULL;
1325                 while(daemon != NULL) {
1326                         tmp = daemon->next;
1327                         __ps_free_daemon(daemon);
1328                         daemon = tmp;
1329                 }
1330         }
1331         /*Free Theme*/
1332         if (package->theme) {
1333                 theme_x *theme = package->theme;
1334                 theme_x *tmp = NULL;
1335                 while(theme != NULL) {
1336                         tmp = theme->next;
1337                         __ps_free_theme(theme);
1338                         theme = tmp;
1339                 }
1340         }
1341         /*Free Font*/
1342         if (package->font) {
1343                 font_x *font = package->font;
1344                 font_x *tmp = NULL;
1345                 while(font != NULL) {
1346                         tmp = font->next;
1347                         __ps_free_font(font);
1348                         font = tmp;
1349                 }
1350         }
1351         /*Free Ime*/
1352         if (package->ime) {
1353                 ime_x *ime = package->ime;
1354                 ime_x *tmp = NULL;
1355                 while(ime != NULL) {
1356                         tmp = ime->next;
1357                         __ps_free_ime(ime);
1358                         ime = tmp;
1359                 }
1360         }
1361         /*Free Compatibility*/
1362         if (package->compatibility) {
1363                 compatibility_x *compatibility = package->compatibility;
1364                 compatibility_x *tmp = NULL;
1365                 while(compatibility != NULL) {
1366                         tmp = compatibility->next;
1367                         __ps_free_compatibility(compatibility);
1368                         compatibility = tmp;
1369                 }
1370         }
1371         /*Free DeviceProfile*/
1372         if (package->deviceprofile) {
1373                 deviceprofile_x *deviceprofile = package->deviceprofile;
1374                 deviceprofile_x *tmp = NULL;
1375                 while(deviceprofile != NULL) {
1376                         tmp = deviceprofile->next;
1377                         __ps_free_deviceprofile(deviceprofile);
1378                         deviceprofile = tmp;
1379                 }
1380         }
1381         free((void*)package);
1382         package = NULL;
1383         return;
1384 }
1385