[FFmpeg-cvslog] ffplay: Fix realloc_texture when input texture is NULL.

2018-05-01 Thread Matt Oliver
ffmpeg | branch: release/4.0 | Matt Oliver  | Tue Apr 10 
23:01:18 2018 +1000| [29328d96b90fc20048803201b379c6c6a18661b4] | committer: 
Marton Balint

ffplay: Fix realloc_texture when input texture is NULL.

SDL_QueryTexture and SDL_DestroyTexture require that the input texture
pointer be non-null. Debug builds of SDL will correctly check for this
and break program execution. This patch fixes this by checking the
status of the texture pointer.

Signed-off-by: Matt Oliver 
(cherry picked from commit 6be690685a8876a61f87b2b8bf30547e09030a96)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=29328d96b90fc20048803201b379c6c6a18661b4
---

 fftools/ffplay.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index bc9ddb8885..dcca9c26d8 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -834,10 +834,11 @@ static int realloc_texture(SDL_Texture **texture, Uint32 
new_format, int new_wid
 {
 Uint32 format;
 int access, w, h;
-if (SDL_QueryTexture(*texture, , , , ) < 0 || new_width 
!= w || new_height != h || new_format != format) {
+if (!*texture || SDL_QueryTexture(*texture, , , , ) < 0 
|| new_width != w || new_height != h || new_format != format) {
 void *pixels;
 int pitch;
-SDL_DestroyTexture(*texture);
+if (*texture)
+SDL_DestroyTexture(*texture);
 if (!(*texture = SDL_CreateTexture(renderer, new_format, 
SDL_TEXTUREACCESS_STREAMING, new_width, new_height)))
 return -1;
 if (SDL_SetTextureBlendMode(*texture, blendmode) < 0)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] ffplay: Fix realloc_texture when input texture is NULL.

2018-04-18 Thread Matt Oliver
ffmpeg | branch: master | Matt Oliver  | Tue Apr 10 
23:01:18 2018 +1000| [6be690685a8876a61f87b2b8bf30547e09030a96] | committer: 
Matt Oliver

ffplay: Fix realloc_texture when input texture is NULL.

SDL_QueryTexture and SDL_DestroyTexture require that the input texture
pointer be non-null. Debug builds of SDL will correctly check for this
and break program execution. This patch fixes this by checking the
status of the texture pointer.

Signed-off-by: Matt Oliver 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6be690685a8876a61f87b2b8bf30547e09030a96
---

 fftools/ffplay.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index bc9ddb8885..dcca9c26d8 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -834,10 +834,11 @@ static int realloc_texture(SDL_Texture **texture, Uint32 
new_format, int new_wid
 {
 Uint32 format;
 int access, w, h;
-if (SDL_QueryTexture(*texture, , , , ) < 0 || new_width 
!= w || new_height != h || new_format != format) {
+if (!*texture || SDL_QueryTexture(*texture, , , , ) < 0 
|| new_width != w || new_height != h || new_format != format) {
 void *pixels;
 int pitch;
-SDL_DestroyTexture(*texture);
+if (*texture)
+SDL_DestroyTexture(*texture);
 if (!(*texture = SDL_CreateTexture(renderer, new_format, 
SDL_TEXTUREACCESS_STREAMING, new_width, new_height)))
 return -1;
 if (SDL_SetTextureBlendMode(*texture, blendmode) < 0)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog