提交 30e3ea4c 编写于 作者: V Vignesh R 提交者: Marek Vasut

dfu: dfu_sf: Pass duplicate devstr to parse_dev

parse_dev() alters the string pointed by devstr parameter. Due to this
subsequent parsing of sf entities will fail, as string pointed by devstr
is no longer valid sf dev arguments.
Fix this by passing pointer to the copy of the string to parse_dev
instead of pointer to the actual devstr.
Signed-off-by: NVignesh R <vigneshr@ti.com>
Reviewed-by: NTom Rini <trini@konsulko.com>
上级 b748b24f
...@@ -115,8 +115,10 @@ static struct spi_flash *parse_dev(char *devstr) ...@@ -115,8 +115,10 @@ static struct spi_flash *parse_dev(char *devstr)
int dfu_fill_entity_sf(struct dfu_entity *dfu, char *devstr, char *s) int dfu_fill_entity_sf(struct dfu_entity *dfu, char *devstr, char *s)
{ {
char *st; char *st;
char *devstr_bkup = strdup(devstr);
dfu->data.sf.dev = parse_dev(devstr); dfu->data.sf.dev = parse_dev(devstr_bkup);
free(devstr_bkup);
if (!dfu->data.sf.dev) if (!dfu->data.sf.dev)
return -ENODEV; return -ENODEV;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册