Fix uninitialized usage of a variable, fix crash in r_str_append (#17830)

In file included from rtr.c:234:0:
rtr_http.c: In function 'r_core_rtr_http_run.isra.1':
rtr_http.c:403:44: warning: 'path' may be used uninitialized in this function [-Wmaybe-uninitialized]
      path = (*index == '/')? strdup (index): r_str_append (path, index);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Co-authored-by: pancake <pancake@nopcode.org>
This commit is contained in:
pancake 2020-10-27 07:24:55 +01:00 committed by GitHub
parent e3f3da5a9e
commit 6009345d63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -374,7 +374,7 @@ static int r_core_rtr_http_run(RCore *core, int launch, int browse, const char *
} else {
const char *root = r_config_get (core->config, "http.root");
const char *homeroot = r_config_get (core->config, "http.homeroot");
char *path;
char *path = NULL;
if (!strcmp (rs->path, "/")) {
free (rs->path);
if (*index == '/') {