fix(object): free placement on actions parse

This commit is contained in:
lisk77 2025-09-21 00:12:40 +02:00
parent cba5d43039
commit 0b7d959663

View file

@ -287,14 +287,13 @@ int read_diff(char* content, char* basefile_hash, ActionList* diff_out) {
char* end; char* end;
long actions = strtol(number_of_actions, &end, 10); long actions = strtol(number_of_actions, &end, 10);
if (end == number_of_actions || *end != '\0' || actions <= 0) { if (end == number_of_actions || *end != '\0' || actions < 0) {
perror("ERROR: invalid number of actions in read_diff!"); perror("ERROR: invalid number of actions in read_diff!");
free(number_of_actions);
return 0; return 0;
} }
free(number_of_actions);
size_t action_idx = 0; size_t action_idx = 0;
while (content[idx] && action_idx < (size_t)actions) { while (content[idx] && action_idx < (size_t)actions) {
idx++; idx++;