[vlc-devel] commit: correctly handle realloc() failure (Justus Piater )

git version control git at videolan.org
Fri Sep 19 16:57:44 CEST 2008


vlc | branch: 0.9-bugfix | Justus Piater <Justus-dev at Piater.name> | Thu Sep 18 10:10:36 2008 +0200| [7b0266794c8ec0139baa4f53728cc34c21ebff70] | committer: Rémi Denis-Courmont 

correctly handle realloc() failure

Signed-off-by: Rémi Denis-Courmont <rdenis at simphalempin.com>
(cherry picked from commit de8a9544f9caf441808a9433077c3ae00e55b1da)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7b0266794c8ec0139baa4f53728cc34c21ebff70
---

 src/misc/objects.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/misc/objects.c b/src/misc/objects.c
index b7ed1e6..e522d52 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -880,8 +880,11 @@ static void vlc_object_detach_unlocked (vlc_object_t *p_this)
 
     if( priv->i_children )
     {
-        priv->pp_children = (vlc_object_t **)realloc( priv->pp_children,
-                               priv->i_children * sizeof(vlc_object_t *) );
+        vlc_object_t **pp_children = (vlc_object_t **)
+            realloc( priv->pp_children,
+                     priv->i_children * sizeof(vlc_object_t *) );
+        if( pp_children )
+            priv->pp_children = pp_children;
     }
     else
     {




More information about the vlc-devel mailing list