check char *h for NULL in r_file_new (#19183)

This commit is contained in:
RHL120 2021-10-07 21:22:49 +02:00 committed by GitHub
parent 9d84785d62
commit 0840a34410
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,6 +57,11 @@ R_API char *r_file_new(const char *root, ...) {
RStrBuf *sb = r_strbuf_new ("");
if (!strcmp (root, "~")) {
char *h = r_str_home (NULL);
if (!h) {
va_end (ap);
r_strbuf_free (sb);
return NULL;
}
r_strbuf_append (sb, h);
free (h);
} else {