Fixed bacnet_strdup() to compile with C89/C90 without warnings.

This commit is contained in:
Steve Karg
2026-03-07 11:55:31 -06:00
parent 926bc17801
commit bd29f1039d
+8 -5
View File
@@ -2196,13 +2196,16 @@ int bacnet_snprintf(
*/
char *bacnet_strdup(const char *s)
{
if (s == NULL) {
return NULL;
}
size_t size = strlen(s) + 1;
char *p = malloc(size);
size_t size;
char *p = NULL;
if (s) {
size = strlen(s) + 1;
p = malloc(size);
if (p != NULL) {
memcpy(p, s, size);
}
}
return p;
}