summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/pbx.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/main/pbx.c b/main/pbx.c
index fe52ea2c7..6b75c77e2 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -4348,9 +4348,11 @@ static int handle_statechange(void *datap)
struct ao2_iterator cb_iter;
if (ao2_container_count(hintdevices) == 0) {
+ ast_free(sc);
return 0;
}
if (!(cmpdevice = ast_malloc(sizeof(*cmpdevice) + strlen(sc->dev)))) {
+ ast_free(sc);
return -1;
}
strcpy(cmpdevice->hintdevice, sc->dev);
@@ -4414,6 +4416,7 @@ static int handle_statechange(void *datap)
if (cmpdevice) {
ast_free(cmpdevice);
}
+ ast_free(sc);
return 0;
}