Skip to content

Commit b76db1d

Browse files
authored
Merge pull request #689 from SoucheSouche/fix/esp-linenoise-static-analyzer-warnings
fix(esp_linenoise): update code to fix static analyzer warning
2 parents a6b5793 + 08a7c0a commit b76db1d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

esp_linenoise/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.0.3"
1+
version: "1.0.4"
22
description: "ESP Linenoise - Line editing C library"
33
url: https://github.com/espressif/idf-extra-components/tree/master/esp_linenoise
44
license: Apache-2.0

esp_linenoise/src/esp_linenoise.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,8 +1297,10 @@ void esp_linenoise_add_completion(void *ctx, const char *str)
12971297
free(copy);
12981298
return;
12991299
}
1300+
1301+
cvec[lc->len] = copy; // Store copy in new slot before updating struct
13001302
lc->cvec = cvec;
1301-
lc->cvec[lc->len++] = copy;
1303+
lc->len++;
13021304
}
13031305

13041306
esp_err_t esp_linenoise_history_add(esp_linenoise_handle_t handle, const char *line)

0 commit comments

Comments
 (0)