diff --git a/libr/util/file.c b/libr/util/file.c index 8647e9d3c1..0518121175 100644 --- a/libr/util/file.c +++ b/libr/util/file.c @@ -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 {