[Spice-devel] [PATCH spice-server 2/3] test-gst: Remove options parsing leaks
Christophe Fergeau
cfergeau at redhat.com
Tue Sep 12 07:30:52 UTC 2017
On Tue, Sep 12, 2017 at 03:19:12AM -0400, Frediano Ziglio wrote:
> > > - const EncoderInfo *encoder = get_encoder_info(encoder_name);
> > > + const EncoderInfo *encoder = get_encoder_info(encoder_name ?
> > > encoder_name : "mjpeg");
> > > if (!encoder) {
> > > g_printerr("Encoder name unsupported: %s\n", encoder_name);
> >
> > This is going to be "Encoder name unsupported: (null)" when the
> > corresponding option is not given, ditto for the other options that you
> > changed.
> >
>
> No, the defaults are present so encoder won't be NULL... but I can change
> the code to make this more clear.
I'm missing something then, the code I quoted is:
const EncoderInfo *encoder = get_encoder_info(encoder_name ? encoder_name : "mjpeg");
if (!encoder) {
g_printerr("Encoder name unsupported: %s\n", encoder_name);
so it looks like encoder_name can be NULL in the call to
get_encoder_info(), in which case we call get_encoder_info("mjpeg")
instead of get_encoder_info(encoder_name), but right after that, in the
g_printerr call, encoder_name cannot be NULL?
Christophe
More information about the Spice-devel
mailing list