@@ -1161,7 +1161,7 @@ int upscli_tryconnect(UPSCONN_t *ups, const char *host, uint16_t port, int flags
1161
1161
1162
1162
pconf_init (& ups -> pc_ctx , NULL );
1163
1163
1164
- ups -> host = strdup (host );
1164
+ ups -> host = xstrdup (host );
1165
1165
1166
1166
if (!ups -> host ) {
1167
1167
ups -> upserror = UPSCLI_ERR_NOMEM ;
@@ -1618,15 +1618,15 @@ int upscli_splitname(const char *buf, char **upsname, char **hostname, uint16_t
1618
1618
1619
1619
s = strchr (tmp , '@' );
1620
1620
1621
- if ((* upsname = strdup (strtok_r (tmp , "@" , & last ))) == NULL ) {
1622
- fprintf (stderr , "upscli_splitname: strdup failed\n" );
1621
+ if ((* upsname = xstrdup (strtok_r (tmp , "@" , & last ))) == NULL ) {
1622
+ fprintf (stderr , "upscli_splitname: xstrdup failed\n" );
1623
1623
return -1 ;
1624
1624
}
1625
1625
1626
1626
/* only a upsname is specified, fill in defaults */
1627
1627
if (s == NULL ) {
1628
- if ((* hostname = strdup ("localhost" )) == NULL ) {
1629
- fprintf (stderr , "upscli_splitname: strdup failed\n" );
1628
+ if ((* hostname = xstrdup ("localhost" )) == NULL ) {
1629
+ fprintf (stderr , "upscli_splitname: xstrdup failed\n" );
1630
1630
return -1 ;
1631
1631
}
1632
1632
@@ -1659,8 +1659,8 @@ int upscli_splitaddr(const char *buf, char **hostname, uint16_t *port)
1659
1659
return -1 ;
1660
1660
}
1661
1661
1662
- if ((* hostname = strdup (strtok_r (tmp + 1 , "]" , & last ))) == NULL ) {
1663
- fprintf (stderr , "upscli_splitaddr: strdup failed\n" );
1662
+ if ((* hostname = xstrdup (strtok_r (tmp + 1 , "]" , & last ))) == NULL ) {
1663
+ fprintf (stderr , "upscli_splitaddr: xstrdup failed\n" );
1664
1664
return -1 ;
1665
1665
}
1666
1666
@@ -1672,8 +1672,8 @@ int upscli_splitaddr(const char *buf, char **hostname, uint16_t *port)
1672
1672
} else {
1673
1673
s = strchr (tmp , ':' );
1674
1674
1675
- if ((* hostname = strdup (strtok_r (tmp , ":" , & last ))) == NULL ) {
1676
- fprintf (stderr , "upscli_splitaddr: strdup failed\n" );
1675
+ if ((* hostname = xstrdup (strtok_r (tmp , ":" , & last ))) == NULL ) {
1676
+ fprintf (stderr , "upscli_splitaddr: xstrdup failed\n" );
1677
1677
return -1 ;
1678
1678
}
1679
1679
0 commit comments