diff options
-rw-r--r-- | src/gallium/state_trackers/omx/vid_dec.c | 41 | ||||
-rw-r--r-- | src/gallium/state_trackers/omx/vid_enc.c | 20 |
2 files changed, 52 insertions, 9 deletions
diff --git a/src/gallium/state_trackers/omx/vid_dec.c b/src/gallium/state_trackers/omx/vid_dec.c index 4442c5c925d..13f4f5558b1 100644 --- a/src/gallium/state_trackers/omx/vid_dec.c +++ b/src/gallium/state_trackers/omx/vid_dec.c @@ -72,6 +72,10 @@ OMX_ERRORTYPE vid_dec_LoaderComponent(stLoaderComponentType *comp) comp->componentVersion.s.nStep = 1; comp->name_specific_length = 2; + comp->name = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); + if (comp->name == NULL) + goto error; + comp->name_specific = CALLOC(comp->name_specific_length, sizeof(char *)); if (comp->name_specific == NULL) goto error; @@ -80,21 +84,44 @@ OMX_ERRORTYPE vid_dec_LoaderComponent(stLoaderComponentType *comp) if (comp->role_specific == NULL) goto error; - comp->name = OMX_VID_DEC_BASE_NAME; - comp->name_specific[0] = OMX_VID_DEC_MPEG2_NAME; - comp->name_specific[1] = OMX_VID_DEC_AVC_NAME; + comp->name_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); + if (comp->name_specific[0] == NULL) + goto error_specific; + + comp->name_specific[1] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); + if (comp->name_specific[1] == NULL) + goto error_specific; + + comp->role_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); + if (comp->role_specific[0] == NULL) + goto error_specific; + + comp->role_specific[1] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); + if (comp->role_specific[1] == NULL) + goto error_specific; + + strcpy(comp->name, OMX_VID_DEC_BASE_NAME); + strcpy(comp->name_specific[0], OMX_VID_DEC_MPEG2_NAME); + strcpy(comp->name_specific[1], OMX_VID_DEC_AVC_NAME); - comp->role_specific[0] = OMX_VID_DEC_MPEG2_ROLE; - comp->role_specific[1] = OMX_VID_DEC_AVC_ROLE; + strcpy(comp->role_specific[0], OMX_VID_DEC_MPEG2_ROLE); + strcpy(comp->role_specific[1], OMX_VID_DEC_AVC_ROLE); comp->constructor = vid_dec_Constructor; return OMX_ErrorNone; -error: +error_specific: + FREE(comp->role_specific[1]); + FREE(comp->role_specific[0]); + FREE(comp->name_specific[1]); + FREE(comp->name_specific[0]); - FREE(comp->name_specific); +error: FREE(comp->role_specific); + FREE(comp->name_specific); + + FREE(comp->name); return OMX_ErrorInsufficientResources; } diff --git a/src/gallium/state_trackers/omx/vid_enc.c b/src/gallium/state_trackers/omx/vid_enc.c index 15eeb091225..871b465f281 100644 --- a/src/gallium/state_trackers/omx/vid_enc.c +++ b/src/gallium/state_trackers/omx/vid_enc.c @@ -105,7 +105,9 @@ OMX_ERRORTYPE vid_enc_LoaderComponent(stLoaderComponentType *comp) comp->name_specific_length = 1; comp->constructor = vid_enc_Constructor; - comp->name = OMX_VID_ENC_BASE_NAME; + comp->name = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); + if (!comp->name) + return OMX_ErrorInsufficientResources; comp->name_specific = CALLOC(1, sizeof(char *)); if (!comp->name_specific) @@ -115,16 +117,30 @@ OMX_ERRORTYPE vid_enc_LoaderComponent(stLoaderComponentType *comp) if (!comp->role_specific) goto error_arrays; - comp->name_specific[0] = OMX_VID_ENC_AVC_NAME; + comp->name_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); + if (comp->name_specific[0] == NULL) + goto error_specific; + + comp->role_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); + if (comp->role_specific[0] == NULL) + goto error_specific; + comp->name = OMX_VID_ENC_BASE_NAME; + comp->name_specific[0] = OMX_VID_ENC_AVC_NAME; comp->role_specific[0] = OMX_VID_ENC_AVC_ROLE; return OMX_ErrorNone; +error_specific: + FREE(comp->role_specific[0]); + FREE(comp->name_specific[0]); + error_arrays: FREE(comp->role_specific); FREE(comp->name_specific); + FREE(comp->name); + return OMX_ErrorInsufficientResources; } |