* @brief Return values in AUL.
*/
typedef enum _aul_return_val {
+ AUL_R_ENOMEM = -16, /**< Out of memory (Since 5.5) */
AUL_R_ENOENT = -15, /**< App directory entry error */
AUL_R_EREJECTED = -14, /**< App disable for mode */
AUL_R_ENOAPP = -13, /**< Failed to find app ID or pkg ID */
b = bundle_create();
if (!b) {
_E("Out of memory");
- return AUL_R_ERROR;
+ return AUL_R_ENOMEM;
}
snprintf(buf, sizeof(buf), "%d", getuid());
b = bundle_create();
if (!b) {
_E("Out of memory");
- return AUL_R_ERROR;
+ return AUL_R_ENOMEM;
}
snprintf(buf, sizeof(buf), "%d", uid);
}
b = NULL;
- if (pkt->opt & AUL_SOCK_BUNDLE)
+ if (pkt->opt & AUL_SOCK_BUNDLE) {
b = bundle_decode(pkt->data, pkt->len);
+ if (!b) {
+ _E("Failed to decode bundle");
+ return AUL_R_ENOMEM;
+ }
+ }
+
free(pkt);
if (!b) {
- _E("Failed to decode bundle");
+ _E("Invalid packet");
return AUL_R_ERROR;
}
context = __create_comp_context(b);
if (!context) {
bundle_free(b);
- return AUL_R_ERROR;
+ return AUL_R_ENOMEM;
}
bundle_free(b);
new_context = calloc(1, sizeof(struct aul_comp_context_s));
if (!new_context) {
_E("Out of memory");
- return AUL_R_ERROR;
+ return AUL_R_ENOMEM;
}
new_context->comp_id = strdup(context->comp_id);
if (new_context)
__destroy_comp_context(new_context);
- return AUL_R_ERROR;
+ return AUL_R_ENOMEM;
}
static int __send_request(aul_comp_context_h handle, int cmd)
b = bundle_create();
if (!b) {
_E("Out of memory");
- return AUL_R_ERROR;
+ return AUL_R_ENOMEM;
}
bundle_add(b, AUL_K_COMPONENT_ID, context->comp_id);
db_path = __get_db_path(uid);
if (!db_path) {
_E("Failed to get db path");
- return AUL_R_ERROR;
+ return AUL_R_ENOMEM;
}
db = __open_db(db_path);
query = sqlite3_mprintf(query_raw, locale, locale, comp_id);
if (!query) {
_E("Out of memory");
- ret = AUL_R_ERROR;
+ ret = AUL_R_ENOMEM;
goto end;
}
info = calloc(1, sizeof(struct aul_comp_info_s));
if (!info) {
_E("Out of memory");
- ret = AUL_R_ERROR;
+ ret = AUL_R_ENOMEM;
goto end;
}
locale = __get_system_locale();
if (!locale)
- return AUL_R_ERROR;
+ return AUL_R_ENOMEM;
ret = __create_comp_info(comp_id, locale, uid, &info);
if (ret != AUL_R_OK && uid != GLOBAL_USER)
new_info = __clone_comp_info(info);
if (!new_info) {
_E("Failed to clone comp info");
- return AUL_R_ERROR;
+ return AUL_R_ENOMEM;
}
*clone = (aul_comp_info_h)new_info;
db_path = __get_db_path(uid);
if (!db_path) {
_E("Failed to get db path");
- return AUL_R_ERROR;
+ return AUL_R_ENOMEM;
}
db = __open_db(db_path);
query = sqlite3_mprintf(query_raw, comp_id, locale);
if (!query) {
_E("Out of memory");
- ret = AUL_R_ERROR;
+ ret = AUL_R_ENOMEM;
goto end;
}
if (val) {
*label = strdup(val);
if (*label == NULL)
- ret = AUL_R_ERROR;
+ ret = AUL_R_ENOMEM;
else
ret = AUL_R_OK;
} else {
locale = __get_system_locale();
if (!locale) {
_E("Failed to get system locale");
- return AUL_R_ERROR;
+ return AUL_R_ENOMEM;
}
ret = __get_comp_info_list(locale, uid, &list);
locale = __get_system_locale();
if (!locale) {
_E("Failed to get system locale");
- return AUL_R_ERROR;
+ return AUL_R_ENOMEM;
}
ret = __get_comp_info_list(locale, uid, &list);
int ret;
switch (res) {
+ case -ENOMEM:
+ ret = AUL_R_ENOMEM;
+ break;
case -EREJECTED:
ret = AUL_R_EREJECTED;
break;