mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-26 22:48:19 +00:00
test-gst: Remove options parsing leaks
Command line options are not freed at the end of the program. These are detected as leaks by leak detector tools like address sanitizer. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
This commit is contained in:
parent
f35843ee6f
commit
9bb2388f75
@ -296,6 +296,7 @@ output_frames(GstSample *sample, void *param)
|
||||
static const EncoderInfo encoder_infos[] = {
|
||||
{ "mjpeg", mjpeg_encoder_new, SPICE_VIDEO_CODEC_TYPE_MJPEG,
|
||||
"caps=image/jpeg", "jpegdec" },
|
||||
#define encoder_info_mjpeg (&encoder_infos[0])
|
||||
{ "gstreamer:mjpeg", gstreamer_encoder_new, SPICE_VIDEO_CODEC_TYPE_MJPEG,
|
||||
"caps=image/jpeg", "jpegdec" },
|
||||
{ "gstreamer:vp8", gstreamer_encoder_new, SPICE_VIDEO_CODEC_TYPE_VP8,
|
||||
@ -314,11 +315,11 @@ static const EncoderInfo encoder_infos[] = {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
gchar *input_pipeline_desc = NULL;
|
||||
const gchar *image_format = "32BIT";
|
||||
const gchar *encoder_name = "mjpeg";
|
||||
gchar *image_format = NULL;
|
||||
gchar *encoder_name = NULL;
|
||||
gchar *file_report_name = NULL;
|
||||
gboolean use_hw_encoder = FALSE; // TODO use
|
||||
const gchar *clipping = "(0,0)x(100%,100%)";
|
||||
gchar *clipping = NULL;
|
||||
|
||||
// - input pipeline
|
||||
// - top/down
|
||||
@ -368,19 +369,24 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
const EncoderInfo *encoder = get_encoder_info(encoder_name);
|
||||
if (!encoder) {
|
||||
g_printerr("Encoder name unsupported: %s\n", encoder_name);
|
||||
exit(1);
|
||||
const EncoderInfo *encoder = encoder_info_mjpeg;
|
||||
if (encoder_name != NULL) {
|
||||
encoder = get_encoder_info(encoder_name);
|
||||
if (!encoder) {
|
||||
g_printerr("Encoder name unsupported: %s\n", encoder_name);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
bitmap_format = get_bitmap_format(image_format);
|
||||
if (bitmap_format == SPICE_BITMAP_FMT_INVALID) {
|
||||
g_printerr("Invalid image format: %s\n", image_format);
|
||||
exit(1);
|
||||
if (image_format != NULL) {
|
||||
bitmap_format = get_bitmap_format(image_format);
|
||||
if (bitmap_format == SPICE_BITMAP_FMT_INVALID) {
|
||||
g_printerr("Invalid image format: %s\n", image_format);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
parse_clipping(clipping);
|
||||
parse_clipping(clipping ? clipping : "(0,0)x(100%,100%)");
|
||||
|
||||
if (minimum_psnr < 0) {
|
||||
g_printerr("Invalid PSNR specified %f\n", minimum_psnr);
|
||||
@ -432,6 +438,12 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
g_free(encoder_name);
|
||||
g_free(image_format);
|
||||
g_free(input_pipeline_desc);
|
||||
g_free(clipping);
|
||||
g_option_context_free(context);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user