Re: [PATCH spice-server 2/3] test-gst: Remove options parsing leaks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> On Tue, Sep 12, 2017 at 03:41:15AM -0400, Frediano Ziglio wrote:
> > > 
> > > 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?
> > > 
> > 
> > No, get_encoder_info("mjpeg") is not supposed to return NULL... but I
> > changed
> > the code to understand it even without reading get_encoder_info, better.
> 
> But you are printing "encoder_name" (the input parameter), not "encoder" (the
> output) !
> 

Yes, the name is encoder_name, the print is referring to name.
By the way, changed code in last version I sent, should be clear, now is

    const EncoderInfo *encoder =
        encoder_name ? get_encoder_info(encoder_name) : encoder_info_mjpeg;
    if (!encoder) {
        g_printerr("Encoder name unsupported: %s\n", encoder_name);
        exit(1);
    }

> Christophe
> 

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]