View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0008047 | GNUnet | util library | public | 2024-01-09 17:06 | 2024-03-07 20:26 |
Reporter | fefe | Assigned To | Christian Grothoff | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Fixed in Version | 0.21.0 | ||||
Summary | 0008047: GNUNET_STRINGS_parse_socket_addr: superfluous strdup call | ||||
Description | This is in gnunet/src/lib/util/strings.c: 1149 size_t 1150 GNUNET_STRINGS_parse_socket_addr (const char *addr, 1151 uint8_t *af, 1152 struct sockaddr **sa) 1153 { 1154 char *cp = GNUNET_strdup (addr); 1155 1156 *af = AF_UNSPEC; 1157 if ('[' == *addr) 1158 { 1159 /* IPv6 */ 1160 *sa = GNUNET_malloc (sizeof(struct sockaddr_in6)); 1161 if (GNUNET_OK != 1162 GNUNET_STRINGS_to_address_ipv6 (cp, 1163 strlen (cp), 1164 (struct sockaddr_in6 *) *sa)) 1165 { 1166 GNUNET_free (*sa); 1167 *sa = NULL; 1168 GNUNET_free (cp); 1169 return 0; 1170 } 1171 *af = AF_INET6; 1172 GNUNET_free (cp); 1173 return sizeof(struct sockaddr_in6); 1174 } 1175 else 1176 { 1177 /* IPv4 */ 1178 *sa = GNUNET_malloc (sizeof(struct sockaddr_in)); 1179 if (GNUNET_OK != 1180 GNUNET_STRINGS_to_address_ipv4 (cp, 1181 strlen (cp), 1182 (struct sockaddr_in *) *sa)) 1183 { 1184 GNUNET_free (*sa); 1185 *sa = NULL; 1186 GNUNET_free (cp); 1187 return 0; 1188 } 1189 *af = AF_INET; 1190 GNUNET_free (cp); 1191 return sizeof(struct sockaddr_in); 1192 } Note that cp is never written to after the strdup. The strdup appears to be superfluous. You might as well just pass the incoming string pointer on. | ||||
Tags | No tags attached. | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2024-01-09 17:06 | fefe | New Issue | |
2024-01-09 19:02 | Christian Grothoff | Changeset attached | => gnunet master 6dcb2075 |
2024-01-09 19:02 | Christian Grothoff | Note Added: 0020841 | |
2024-01-09 19:02 | Christian Grothoff | Assigned To | => Christian Grothoff |
2024-01-09 19:02 | Christian Grothoff | Status | new => resolved |
2024-01-09 19:02 | Christian Grothoff | Resolution | open => fixed |
2024-01-09 20:10 | Christian Grothoff | Project | Taler => GNUnet |
2024-01-09 20:10 | Christian Grothoff | Category | other => util library |
2024-03-07 20:26 | schanzen | Fixed in Version | => 0.21.0 |
2024-03-07 20:26 | schanzen | Note Added: 0021799 | |
2024-03-07 20:26 | schanzen | Status | resolved => closed |