Fix a few more memory leaks

This commit is contained in:
Mike Brady
2021-12-07 19:58:00 +00:00
parent 765a489db4
commit 7258a45bea
3 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -112,7 +112,7 @@ static void resolve_callback(AvahiServiceResolver *r, AVAHI_GCC_UNUSED AvahiIfIn
char portstring[20];
memset(portstring, 0, sizeof(portstring));
snprintf(portstring, sizeof(portstring), "%u", port);
send_ssnc_metadata('dapo', strdup(portstring), strlen(portstring), 0);
send_ssnc_metadata('dapo', portstring, strlen(portstring), 0);
#endif
}
} else {
+7 -1
View File
@@ -2282,7 +2282,7 @@ void handle_command(__attribute__((unused)) rtsp_conn_info *conn, rtsp_message *
if (item != NULL) {
char *typeValue = NULL;
plist_get_string_val(item, &typeValue);
if (strcmp(typeValue, "updateMRSupportedCommands") == 0) {
if ((typeValue != NULL) && (strcmp(typeValue, "updateMRSupportedCommands") == 0)) {
item = plist_dict_get_item(command_dict, "params");
if (item != NULL) {
// the item should be a dict
@@ -2331,6 +2331,8 @@ void handle_command(__attribute__((unused)) rtsp_conn_info *conn, rtsp_message *
"POST /command plist type is \"%s\", but \"updateMRSupportedCommands\" expected.",
typeValue);
}
if (typeValue != NULL)
free(typeValue);
} else {
debug(1, "Could not get the \"type\" item.");
}
@@ -2523,6 +2525,10 @@ void handle_teardown_2(rtsp_conn_info *conn, __attribute__((unused)) rtsp_messag
debug(1, "Connection %d: missing plist!", conn->connection_number);
resp->respcode = 451; // don't know what to do here
}
if (conn->dacp_active_remote != NULL) {
free(conn->dacp_active_remote);
conn->dacp_active_remote = NULL;
}
debug(1,"Bogus exit for valgrind.");
exit(EXIT_SUCCESS); //
}
+1 -1
View File
@@ -1843,7 +1843,7 @@ int main(int argc, char **argv) {
char *uuid = malloc(UUID_STR_LEN);
// Produces a UUID string at uuid consisting of lower-case letters
uuid_unparse_lower(binuuid, uuid);
config.airplay_pi = strdup(uuid);
config.airplay_pi = uuid;
debug(1, "Started in Airplay 2 mode on device \"%s\"!", config.airplay_device_id);
#else
debug(1, "Started in Airplay 1 mode!");