mirror of
https://protopirate.net/ProtoPirate/ProtoPirate.git
synced 2026-05-31 15:25:29 +00:00
do not free/realloc furi_string as flipper_format_read_string is doing a reset of the string, check for problems and return error
This commit is contained in:
+9
-2
@@ -226,18 +226,20 @@ SubGhzProtocolStatus
|
||||
|
||||
do {
|
||||
FuriString* temp_str = furi_string_alloc();
|
||||
furi_check(temp_str);
|
||||
if(!flipper_format_read_string(flipper_format, "Protocol", temp_str)) {
|
||||
FURI_LOG_E(TAG, "Missing Protocol");
|
||||
furi_string_free(temp_str);
|
||||
temp_str = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!furi_string_equal(temp_str, instance->base.protocol->name)) {
|
||||
FURI_LOG_E(TAG, "Wrong protocol: %s", furi_string_get_cstr(temp_str));
|
||||
furi_string_free(temp_str);
|
||||
temp_str = NULL;
|
||||
break;
|
||||
}
|
||||
furi_string_free(temp_str);
|
||||
|
||||
uint32_t bit_count_temp;
|
||||
if(!flipper_format_read_uint32(flipper_format, "Bit", &bit_count_temp, 1)) {
|
||||
@@ -245,13 +247,18 @@ SubGhzProtocolStatus
|
||||
break;
|
||||
}
|
||||
|
||||
temp_str = furi_string_alloc();
|
||||
if(!flipper_format_read_string(flipper_format, "Key", temp_str)) {
|
||||
FURI_LOG_E(TAG, "Missing Key");
|
||||
furi_string_free(temp_str);
|
||||
temp_str = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
// if no string to decode return error
|
||||
if(!temp_str) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char* key_str = furi_string_get_cstr(temp_str);
|
||||
uint64_t key = 0;
|
||||
size_t str_len = strlen(key_str);
|
||||
|
||||
Reference in New Issue
Block a user