snprintf(ad->mime, sizeof(ad->mime), "%s", mime);
appcontrol = calloc(1, sizeof(appcontrol_x));
+ if (appcontrol == NULL) {
+ _LOGD("Malloc Failed\n");
+ return;
+ }
if (strlen(ad->operation))
appcontrol->operation = strdup(ad->operation);
if (strlen(ad->uri))
g_list_foreach(ad->mimes, __ps_process_mime, user_data);
} else {
appcontrol = calloc(1, sizeof(appcontrol_x));
+ if (appcontrol == NULL) {
+ _LOGD("Malloc Failed\n");
+ return;
+ }
if (strlen(ad->operation))
appcontrol->operation = strdup(ad->operation);
appcontrol->uri = strdup(ad->uri);
g_list_foreach(ad->mimes, __ps_process_mime, user_data);
} else {
appcontrol = calloc(1, sizeof(appcontrol_x));
+ if (appcontrol == NULL) {
+ _LOGD("Malloc Failed\n");
+ return;
+ }
appcontrol->operation = strdup(ad->operation);
ad->appcontrols = g_list_append(ad->appcontrols, appcontrol);
}
for (tag = strdup(tagv[0]); tag != NULL; ) {
ret_result = strtok_r(tag, delims, &ptr);
-
- /*check tag : preload */
- if (strcmp(ret_result, "preload") == 0) {
- ret_result = strtok_r(NULL, delims, &ptr);
- if (strcmp(ret_result, "true") == 0) {
- free((void *)mfx->preload);
- mfx->preload = strdup("true");
- } else if (strcmp(ret_result, "false") == 0) {
- free((void *)mfx->preload);
- mfx->preload = strdup("false");
- }
- /*check tag : removable*/
- } else if (strcmp(ret_result, "removable") == 0) {
- ret_result = strtok_r(NULL, delims, &ptr);
- if (strcmp(ret_result, "true") == 0) {
- free((void *)mfx->removable);
- mfx->removable = strdup("true");
- } else if (strcmp(ret_result, "false") == 0) {
- free((void *)mfx->removable);
- mfx->removable = strdup("false");
- }
- /*check tag : not matched*/
- } else
- _LOGD("tag process [%s]is not defined\n", ret_result);
-
+ if (ret_result != NULL) {
+ /*check tag : preload */
+ if (strcmp(ret_result, "preload") == 0) {
+ ret_result = strtok_r(NULL, delims, &ptr);
+ if (ret_result && strcmp(ret_result, "true") == 0) {
+ free((void *)mfx->preload);
+ mfx->preload = strdup("true");
+ } else if (ret_result && strcmp(ret_result, "false") == 0) {
+ free((void *)mfx->preload);
+ mfx->preload = strdup("false");
+ }
+ /*check tag : removable*/
+ } else if (strcmp(ret_result, "removable") == 0) {
+ ret_result = strtok_r(NULL, delims, &ptr);
+ if (ret_result && strcmp(ret_result, "true") == 0) {
+ free((void *)mfx->removable);
+ mfx->removable = strdup("true");
+ } else if (ret_result && strcmp(ret_result, "false") == 0) {
+ free((void *)mfx->removable);
+ mfx->removable = strdup("false");
+ }
+ /*check tag : not matched*/
+ } else
+ _LOGD("tag process [%s]is not defined\n", ret_result);
+ }
free(tag);
/*check next value*/