[MPlayer-dev-eng] [PATCH] Useless if NULL before free: libmp{codecs, demux}

Diego Biurrun diego at biurrun.de
Tue Nov 9 22:20:01 CET 2010


On Mon, Nov 08, 2010 at 11:51:33PM +0100, Clément Bœsch wrote:
> 
> If no one object until sunday (do you need more time?) I'll commit it.
> Patch reattached without the gzip compression since it does not seem to be
> limited anymore.
> 
> --- a/gui/mplayer/gtk/pl.c
> +++ b/gui/mplayer/gtk/pl.c
> @@ -160,7 +160,7 @@ void ShowPlayList( void )
>  	DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( CTDirTree ),node );
>  	current_path=DirNode->path;
>          scan_dir( DirNode->path );
> -        if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
> +        free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );

Please break this line while you're at it.

> @@ -195,7 +195,7 @@ void HidePlayList( void )
>   NrOfSelected=NrOfEntrys=0;
>   gfree( (void **)&CLListSelected ); gfree( (void **)&CLFileSelected );
> - if ( old_path ) free( old_path ); old_path=strdup( current_path );
> + free( old_path ); old_path=strdup( current_path );

ditto

> @@ -406,7 +406,7 @@ static void plCTRow(GtkWidget * widget, gint row, gint column, GdkEventButton *
>   gtk_ctree_expand( GTK_CTREE( widget ),node );
>   scan_dir( DirNode->path );
> - if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
> + free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );

again

> --- a/libmpcodecs/vf_fspp.c
> +++ b/libmpcodecs/vf_fspp.c
> @@ -576,13 +576,13 @@ static void uninit(struct vf_instance *vf)
>  
> -    if(vf->priv->temp) av_free(vf->priv->temp);
> +    av_free(vf->priv->temp);
>      vf->priv->temp= NULL;
> -    if(vf->priv->src)  av_free(vf->priv->src);
> +    av_free(vf->priv->src);
>      vf->priv->src= NULL;
> -    //if(vf->priv->avctx) free(vf->priv->avctx);
> +    //free(vf->priv->avctx);
>      //vf->priv->avctx= NULL;
> -    if(vf->priv->non_b_qp) free(vf->priv->non_b_qp);
> +    free(vf->priv->non_b_qp);
>      vf->priv->non_b_qp= NULL;
>  
> --- a/libmpcodecs/vf_geq.c
> +++ b/libmpcodecs/vf_geq.c
> @@ -128,8 +128,6 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
>  
>  static void uninit(struct vf_instance *vf){
> -    if(!vf->priv) return;
> -
>      av_free(vf->priv);

Maybe the av_free should go in another commit.

> --- a/libmpdemux/demux_realaud.c
> +++ b/libmpdemux/demux_realaud.c
> @@ -334,14 +334,12 @@ static demuxer_t* demux_open_ra(demuxer_t* demuxer)
>  
>  static void demux_close_ra(demuxer_t *demuxer)
>  {
> -	ra_priv_t* ra_priv = demuxer->priv;
> +    ra_priv_t* ra_priv = demuxer->priv;

unrelated cosmetics


Patch looks OK otherwise, commit anytime.

Diego


More information about the MPlayer-dev-eng mailing list