Fix sizeof mismatch (cid #1064682)

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
Fix memory leak (cid #1048910)

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
Fix VLC_CLIP usage (and potential divisions by zero)

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>