Avoid potential use of NULL pointer.

svn path=/trunk/netsurf/; revision=10588
This commit is contained in:
John Mark Bell 2010-06-29 06:05:54 +00:00
parent 6ab058fb46
commit a327c4e624

View File

@ -751,6 +751,10 @@ char *path_to_url(const char *path)
int urllen = strlen(path) + FILE_SCHEME_PREFIX_LEN + 1;
char *url = malloc(urllen);
if (url == NULL) {
return NULL;
}
if (*path == '/') {
path++; /* file: paths are already absolute */
}