More argument checking

This commit is contained in:
Pierre Pronchery 2014-04-26 01:33:33 +08:00
parent 5d6d2e499f
commit f55c6cfdff

View File

@ -93,6 +93,12 @@ AppTransport * apptransport_new(AppTransportMode mode,
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s(\"%s\", \"%s\")\n", __func__, plugin, name);
#endif
/* check the arguments */
if(name == NULL || name[0] == '\0')
{
error_set_code(1, "%s", "Invalid transport");
return NULL;
}
/* allocate the transport */
if((transport = object_new(sizeof(*transport))) == NULL)
return NULL;