[FFmpeg-devel] [PATCH 2/4] avutil/opt: set_string: allow src=dst
Nicolas George
george at nsup.org
Sun Jun 1 15:52:06 CEST 2014
Le primidi 11 prairial, an CCXXII, Michael Niedermayer a écrit :
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
> libavutil/opt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/opt.c b/libavutil/opt.c
> index b4dd0fd..72de041 100644
> --- a/libavutil/opt.c
> +++ b/libavutil/opt.c
> @@ -181,7 +181,8 @@ static int set_string_binary(void *obj, const AVOption *o, const char *val, uint
>
> static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst)
> {
> - av_freep(dst);
> + if (*dst != val)
> + av_freep(dst);
> *dst = av_strdup(val);
> return 0;
> }
The whole patch series seems like a good idea. Can you explain in what case
exactly this one is needed? It seems a bit tricky to use due to possible
leaks.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140601/43824e50/attachment.asc>
More information about the ffmpeg-devel
mailing list