CHAOS: prevent sorcery object with null id

When allocating a sorcery object, fail if the
id value was not allocated.

ASTERISK-25323
Reported by: Scott Griepentrog

Change-Id: I152133fb7545a4efcf7a0080ada77332d038669e
changes/01/1101/1
Scott Griepentrog 10 years ago committed by Scott Griepentrog
parent b719f56c72
commit ab373f2cef

@ -1736,6 +1736,10 @@ void *ast_sorcery_alloc(const struct ast_sorcery *sorcery, const char *type, con
} else {
details->object->id = ast_strdup(id);
}
if (!details->object->id) {
ao2_ref(details, -1);
return NULL;
}
ast_copy_string(details->object->type, type, sizeof(details->object->type));

Loading…
Cancel
Save