framelinksrc: allocate memory for strings in camConfig struct to avoid exception

This commit is contained in:
Joshua M. Doe 2014-01-15 08:56:33 -05:00
parent 221bba5901
commit 60af9bc88f

View File

@ -285,6 +285,16 @@ gst_framelinksrc_start (GstBaseSrc * bsrc)
return FALSE; return FALSE;
} }
/* get configuration from file */
camConfig.cchAlias = MAX_PATH;
camConfig.lpszAlias = g_new (gchar, MAX_PATH);
camConfig.cchDescription = MAX_PATH;
camConfig.lpszDescription = g_new (gchar, MAX_PATH);
camConfig.cchManufacturer = MAX_PATH;
camConfig.lpszManufacturer = g_new (gchar, MAX_PATH);
camConfig.cchModel = MAX_PATH;
camConfig.lpszModel = g_new (gchar, MAX_PATH);
err = VCECLB_LoadConfigA (src->format_file, &camConfig); err = VCECLB_LoadConfigA (src->format_file, &camConfig);
if (err != VCECLB_Err_Success) { if (err != VCECLB_Err_Success) {
GST_ELEMENT_ERROR (src, RESOURCE, FAILED, GST_ELEMENT_ERROR (src, RESOURCE, FAILED,
@ -292,6 +302,13 @@ gst_framelinksrc_start (GstBaseSrc * bsrc)
return FALSE; return FALSE;
} }
GST_INFO_OBJECT (src, "Loaded config file for %s - %s",
camConfig.lpszManufacturer, camConfig.lpszModel);
g_free (camConfig.lpszAlias);
g_free (camConfig.lpszDescription);
g_free (camConfig.lpszManufacturer);
g_free (camConfig.lpszModel);
if (camConfig.pixelInfo.cameraData.Packed == 1) { if (camConfig.pixelInfo.cameraData.Packed == 1) {
GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS,
("Packed pixel data not supported yet."), (NULL)); ("Packed pixel data not supported yet."), (NULL));