On 31.07.2014, at 01:47, g...@videolan.org (Jean-Baptiste Kempf) wrote:
> libdvdnav | branch: master | Jean-Baptiste Kempf <j...@videolan.org> | Thu 
> Jul 31 01:47:26 2014 +0200| [b077704654121cb1d08fbd3da5a3b9b58b67b53b] | 
> committer: Jean-Baptiste Kempf
> 
> Do not reinvent strdup
> 
> Fixes builds for Hurd...
> 
>> http://git.videolan.org/gitweb.cgi/libdvdnav.git/?a=commit;h=b077704654121cb1d08fbd3da5a3b9b58b67b53b
> ---
> 
> src/dvdnav.c          |    7 ++++---
> src/dvdnav_internal.h |    9 +--------
> 2 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/src/dvdnav.c b/src/dvdnav.c
> index d8da517..33367db 100644
> --- a/src/dvdnav.c
> +++ b/src/dvdnav.c
> @@ -162,9 +162,10 @@ dvdnav_status_t dvdnav_open(dvdnav_t** dest, const char 
> *path) {
>     return DVDNAV_STATUS_ERR;
>   }
> 
> -  /* Set the path. FIXME: Is a deep copy 'right' */
> -  strncpy(this->path, path, MAX_PATH_LEN - 1);
> -  this->path[MAX_PATH_LEN - 1] = '\0';
> +  /* Set the path. */
> +  this->path = strdup(path);
> +  if(!this->path)
> +    return DVDNAV_STATUS_ERR;

Am I missing something or did you forget to add one or more free() somewhere?
I'd expect avoiding that was why it was done like that...
_______________________________________________
DVDnav-discuss mailing list
DVDnav-discuss@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/dvdnav-discuss

Reply via email to