void pnd_disco_destroy ( pnd_disco_t *p ) {
if ( p -> package_id ) { free ( p -> package_id); }
if ( p -> title_en ) { free ( p -> title_en ); }
+ if ( p -> desc_en ) { free ( p -> desc_en ); }
if ( p -> unique_id ) { free ( p -> unique_id ); }
if ( p -> appdata_dirname ) { free ( p -> appdata_dirname ); }
if ( p -> icon ) { free ( p -> icon ); }
if ( p -> alt_category ) { free ( p -> alt_category ); }
if ( p -> alt_category1 ) { free ( p -> alt_category1 ); }
if ( p -> alt_category2 ) { free ( p -> alt_category2 ); }
+ if ( p -> object_filename ) { free ( p -> object_filename ); }
+ if ( p -> object_path ) { free ( p -> object_path ); }
if ( p -> mkdir_sp ) { free ( p -> mkdir_sp ); }
if ( p -> info_name ) { free ( p -> info_name ); }
if ( p -> info_type ) { free ( p -> info_type ); }
if ( p -> info_filename ) { free ( p -> info_filename ); }
-
+ if ( p -> preview_pic1 ) { free ( p -> preview_pic1 ); }
+ if ( p -> preview_pic2 ) { free ( p -> preview_pic2 ); }
return;
}
if ( pnd_pxml_get_package_id ( pxmlh ) ) {
p -> package_id = strdup ( pnd_pxml_get_package_id ( pxmlh ) );
}
- if ( pnd_pxml_get_app_name_en ( pxmlh ) ) {
- p -> title_en = strdup ( pnd_pxml_get_app_name_en ( pxmlh ) );
+ char *name_en = pnd_pxml_get_app_name_en ( pxmlh );
+ if (name_en) {
+ p -> title_en = name_en; /* already strdupped */
}
- if ( pnd_pxml_get_description_en ( pxmlh ) ) {
- p -> desc_en = strdup ( pnd_pxml_get_description_en ( pxmlh ) );
+ char *desc_en = pnd_pxml_get_description_en ( pxmlh );
+ if ( desc_en ) {
+ p -> desc_en = desc_en; /* already strdupped */
}
if ( pnd_pxml_get_icon ( pxmlh ) ) {
p -> icon = strdup ( pnd_pxml_get_icon ( pxmlh ) );
free(p->descriptions);
}
+ if ( p -> unique_id ) {
+ free ( p -> unique_id );
+ }
+ if ( p -> package_id ) {
+ free ( p -> package_id );
+ }
if ( p -> standalone ) {
free ( p -> standalone );
}
if ( p -> appdata_dirname ) {
free ( p -> appdata_dirname );
}
+ if ( p -> info_name ) {
+ free ( p -> info_name );
+ }
+ if ( p -> info_filename ) {
+ free ( p -> info_filename );
+ }
+ if ( p -> info_type ) {
+ free ( p -> info_type );
+ }
+ if ( p -> exec_no_x11 ) {
+ free ( p -> exec_no_x11 );
+ }
+ if ( p -> execargs ) {
+ free ( p -> execargs );
+ }
free(p); /*very important!*/
}
if ( ! ( lang = pnd_pxml_get_attribute ( pElem, PND_PXML_ATTRNAME_DESCRLANG ) ) ) {
+ if(text) free(text); text = NULL;
continue;
}
{
app->descriptions_alloc_c <<= 1;
app->descriptions = (pnd_localized_string_t*)realloc((void*)app->descriptions, app->descriptions_alloc_c * sizeof(pnd_localized_string_t) );
- if (!app->descriptions) return (0); //errno = ENOMEM
+ if (!app->descriptions) { if(text) free(text); if(lang) free(lang); return (0); } //errno = ENOMEM
}
pnd_localized_string_t *description = &app->descriptions[app->descriptions_c - 1];
} else {
// fallback to older approach
- for (pElem = hRoot.FirstChild(PND_PXML_ENAME_DESCRIPTION).Element(); pElem;
+ for (pElem = hRoot.FirstChild(PND_PXML_ENAME_DESCRIPTION).Element(); pElem;
pElem = pElem->NextSiblingElement(PND_PXML_ENAME_DESCRIPTION))
{
if (!text) continue;
char *lang = pnd_pxml_get_attribute(pElem, PND_PXML_ATTRNAME_DESCRLANG);
- if (!lang) continue;
+ if (!lang) { if(text) free(text); text = NULL; continue; }
app->descriptions_c++;
if (app->descriptions_c > app->descriptions_alloc_c) //we don't have enough strings allocated
{
app->descriptions_alloc_c <<= 1;
app->descriptions = (pnd_localized_string_t*)realloc((void*)app->descriptions, app->descriptions_alloc_c * sizeof(pnd_localized_string_t) );
- if (!app->descriptions) return (0); //errno = ENOMEM
+ if (!app->descriptions) { if(text) free(text); if(lang) free(lang); return (0); } //errno = ENOMEM
}
pnd_localized_string_t *description = &app->descriptions[app->descriptions_c - 1];
} else {
app -> subapp_number = 0;
}
-
+
// give application the package id, if there is one
- app -> package_id = package_id;
+ if( package_id )
+ app -> package_id = strdup(package_id);
//Get unique ID first.
if ( appwrappermode ) {
} // while finding apps
+ if( package_id )
+ free(package_id);
+
return (1);
}