summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2014-06-26 17:43:46 +0100
committerEmil Velikov <[email protected]>2014-06-27 19:13:31 +0100
commita001ca98e155213ebde343957a934e1b8bb9db3d (patch)
tree8ac7669349d53669bcb4e9d3dde356b565fed5f7 /src/gallium
parented663124263993ce19ff56e7e91b70e2b319d612 (diff)
st/omx: keep the name, (name|role)_specific strings dynamically allocated
... as it's caller (the external program omxregister-bellagio) is the one who frees all of the allocated memory. Reported-by: Pedretti Fabio <[email protected]> Tested-by: Fabio Pedretti <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/omx/vid_dec.c41
-rw-r--r--src/gallium/state_trackers/omx/vid_enc.c20
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;
}