Merge pull request #44 from plieven/master

fix 3 flaws detected by valgrind and bump version to intermediate version
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2013-12-26 11:00:04 -08:00
commit 8aab33e33c
3 changed files with 8 additions and 6 deletions

View File

@ -1,5 +1,5 @@
AC_PREREQ(2.50)
AC_INIT([libnfs], [1.8.0], [ronniesahlberg@gmail.com])
AC_INIT([libnfs], [1.8.90], [ronniesahlberg@gmail.com])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign])
AC_CANONICAL_HOST

View File

@ -132,6 +132,7 @@ open_file(const char *url, int flags)
file_context->fd = -1;
file_context->nfs = NULL;
file_context->nfsfh = NULL;
file_context->url = NULL;
if (strncmp(url, "nfs://", 6)) {
file_context->is_nfs = 0;

View File

@ -201,6 +201,7 @@ static struct nfs_url *nfs_parse_url(struct nfs_context *nfs, const char *url, i
return NULL;
}
memset(urls, 0x00, sizeof(struct nfs_url));
urls->server = strdup(url + 6);
if (urls->server == NULL) {
nfs_destroy_url(urls);
@ -277,11 +278,6 @@ flags:
}
}
if (urls->server && strlen(urls->server) <= 1) {
free(urls->server);
urls->server = NULL;
}
while (flagsp != NULL && *(flagsp+1) != 0) {
strp = flagsp + 1;
flagsp = strchr(strp, '&');
@ -296,6 +292,11 @@ flags:
}
}
if (urls->server && strlen(urls->server) <= 1) {
free(urls->server);
urls->server = NULL;
}
return urls;
}