Skip to content

Commit f7b1bc9

Browse files
committed
fix crash when toscaIntrConnectHandler is called from iocsh without arguments
1 parent 1cc7dac commit f7b1bc9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

toscaIocsh.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,6 @@ static void toscaIntrConnectHandlerFunc(const iocshArgBuf *args)
592592
{
593593
intrmask_t mask = toscaStrToIntrMask(args[0].sval);
594594
void (*function)() = symbolAddr(args[1].sval);
595-
void* arg = args[2].sval ? strdup(args[2].sval) : strdup(args[0].sval);
596595

597596
if (!args[0].sval)
598597
{
@@ -610,7 +609,9 @@ static void toscaIntrConnectHandlerFunc(const iocshArgBuf *args)
610609
fprintf(stderr, "Invalid function \"%s\"\n", args[1].sval);
611610
return;
612611
}
613-
if (toscaIntrConnectHandler(mask, function, arg) != 0) fprintf(stderr, "%m\n");
612+
if (toscaIntrConnectHandler(mask, function,
613+
strdup(args[2].sval ? args[2].sval : args[0].sval)) != 0)
614+
fprintf(stderr, "%m\n");
614615
}
615616

616617
static const iocshFuncDef toscaIntrDisconnectHandlerDef =

0 commit comments

Comments
 (0)