aboutsummaryrefslogtreecommitdiffstats
path: root/src/control.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/control.c')
-rw-r--r--src/control.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/control.c b/src/control.c
index 7150032..68a5bfb 100644
--- a/src/control.c
+++ b/src/control.c
@@ -170,10 +170,13 @@ new_property_control(LilvWorld* const world,
void
add_control(Controls* controls, ControlID* control)
{
- controls->controls = (ControlID**)realloc(
+ ControlID** const new_controls = (ControlID**)realloc(
controls->controls, (controls->n_controls + 1) * sizeof(ControlID*));
- controls->controls[controls->n_controls++] = control;
+ if (new_controls) {
+ controls->controls = new_controls;
+ controls->controls[controls->n_controls++] = control;
+ }
}
ControlID*