diff options
-rw-r--r-- | media/libeffects/factory/EffectsFactory.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/media/libeffects/factory/EffectsFactory.c b/media/libeffects/factory/EffectsFactory.c index 4b74208e79..bdf707d770 100644 --- a/media/libeffects/factory/EffectsFactory.c +++ b/media/libeffects/factory/EffectsFactory.c @@ -608,6 +608,11 @@ int addSubEffect(cnode *root) return -EINVAL; } d = malloc(sizeof(effect_descriptor_t)); + if (!d) { + ALOGE("failed to allocate effect descriptor"); + return -EINVAL; + } + if (l->desc->get_descriptor(&uuid, d) != 0) { char s[40]; uuidToString(&uuid, s, 40); @@ -692,8 +697,12 @@ int loadEffect(cnode *root) ALOGW("loadEffect() invalid uuid %s", node->value); return -EINVAL; } - d = malloc(sizeof(effect_descriptor_t)); + if (!d) { + ALOGE("failed to allocate effect descriptor"); + return -EINVAL; + } + if (l->desc->get_descriptor(&uuid, d) != 0) { char s[40]; uuidToString(&uuid, s, 40); |