[libbluray-devel] [Git][videolan/libbluray][master] bd_info: avoid str nulled but not freed upon realloc failure

Petri Hintukainen (@hpi) gitlab at videolan.org
Wed Sep 21 15:54:14 UTC 2022



Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
dc59f1fd by Mark Esler at 2022-09-21T15:54:10+00:00
bd_info: avoid str nulled but not freed upon realloc failure

- - - - -


1 changed file:

- src/examples/bd_info.c


Changes:

=====================================
src/examples/bd_info.c
=====================================
@@ -51,8 +51,11 @@ static const char *_hex2str(const uint8_t *data, size_t len)
     static char *str = NULL;
     size_t i;
 
-    str = (char*)realloc(str, 2*len + 1);
-    if (!str)
+
+    char *tmp = (char*)realloc(str, 2*len + 1);
+    if (tmp)
+        str = tmp;
+    else
         return "";
     *str = 0;
 



View it on GitLab: https://code.videolan.org/videolan/libbluray/-/commit/dc59f1fdc04edc11f26878fa30a7c8269be4b9fd

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/commit/dc59f1fdc04edc11f26878fa30a7c8269be4b9fd
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the libbluray-devel mailing list