[DVDnav-discuss] [libdvdnav-devel] [PATCH] Set all freed pointers to NULL; for ifofiles, set pointers to NULL instead of zero

Jean-Baptiste Kempf jb at videolan.org
Sat Jan 3 21:42:02 CET 2015


On 03 Jan, Steve Dibb wrote :
> -  if(ifofile->vmgi_mat)
> +  if(ifofile->vmgi_mat) {
>      free(ifofile->vmgi_mat);
> +    ifofile->vmgi_mat = NULL;
> +  }

free( NULL ) is a no-op. The if is useless.

> -  if(ifofile->vtsi_mat)
> +  if(ifofile->vtsi_mat) {
>      free(ifofile->vtsi_mat);
> +    ifofile->vtsi_mat = NULL;
> +  }

idem

      if(!cmd_tbl->post_cmds) {
> -      if(cmd_tbl->pre_cmds)
> +      if(cmd_tbl->pre_cmds) {
>          free(cmd_tbl->pre_cmds);
> +	cmd_tbl->pre_cmds = NULL;
> +      }

idem

> post_cmds_size))) {
> -      if(cmd_tbl->pre_cmds)
> +      if(cmd_tbl->pre_cmds) {
>          free(cmd_tbl->pre_cmds);
> +	cmd_tbl->pre_cmds = NULL;
> +      }
>        free(cmd_tbl->post_cmds);

And again.

With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device


More information about the DVDnav-discuss mailing list