Browse Source

tests: setprop_inplace: use xstrdup instead of unchecked strdup

This is the only strdup instance we have, all others are xstrdup. As
strdup is _POSIX_C_SOURCE >= v200809L, which we don't require and we
don't check strdup error return here, switch to xstrdup instead. This
aligns the test with others that call xfuncs, mainly xmalloc().

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
Ahmad Fatoum 3 years ago committed by David Gibson
parent
commit
cd5f69cbc0
  1. 2
      tests/setprop_inplace.c

2
tests/setprop_inplace.c

@ -58,7 +58,7 @@ int main(int argc, char *argv[]) @@ -58,7 +58,7 @@ int main(int argc, char *argv[])
TEST_STRING_1);

verbose_printf("Old string value was \"%s\"\n", strp);
xstr = strdup(strp);
xstr = xstrdup(strp);
xlen = strlen(xstr);
for (i = 0; i < xlen; i++)
xstr[i] = toupper(xstr[i]);

Loading…
Cancel
Save