#include <vlc_common.h>
#include <vlc_charset.h>
+#include <vlc_memory.h>
#include "variables.h"
#include "libvlc.h"
if( (p_priv->i_vars & 15) == 15 )
{
- p_priv->p_vars = realloc( p_priv->p_vars,
+ p_priv->p_vars = realloc_or_free( p_priv->p_vars,
(p_priv->i_vars+17) * sizeof(variable_t) );
+ assert( p_priv->p_vars );
}
memmove( p_priv->p_vars + i_new + 1,
if( (p_priv->i_vars & 15) == 0 )
{
- p_priv->p_vars = realloc( p_priv->p_vars,
- (p_priv->i_vars) * sizeof( variable_t ) );
+ variable_t *p_vars = realloc( p_priv->p_vars,
+ (p_priv->i_vars) * sizeof( variable_t ) );
+ if( p_vars )
+ p_priv->p_vars = p_vars;
}
p_priv->i_vars--;