LibBSD | rtemsbsd: Fix warnings in wpa_supplicant_fork (!123)
Kinsey Moore (@opticron)
gitlab at rtems.org
Mon Feb 23 15:29:22 UTC 2026
Kinsey Moore started a new discussion on rtemsbsd/rtems/rtems-bsd-shell-wpa_supplicant_fork.c: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/123#note_143296
> - struct myparams *params = malloc(sizeof(struct myparams));
> + struct myparams *params = (struct myparams*)malloc(sizeof(struct myparams));
> if (params == NULL)
> - return NULL;
> + return -1;
>
> params->argc = argc;
> - params->argv = malloc((argc + 1) * sizeof(argv[0]));
> + params->argv = (char**)malloc((argc + 1) * sizeof(argv[0]));
> if (params->argv == NULL)
> - return NULL;
> + return -1;
>
> for (i = 0; i < argc; i++) {
> - params->argv[i] = strdup(argv[i]);
> + params->argv[i] = (char*)strdup(argv[i]);
`strdup()` should already be returning a `char *`. Why is this necessary?
--
View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/merge_requests/123#note_143296
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260223/40913da3/attachment-0001.htm>
More information about the bugs
mailing list