Merge branch 'jk/pstat_getfile2'

This commit is contained in:
Doug MacEachern 2009-02-06 17:34:36 -08:00
parent 9774d05e20
commit 22dec9316c
1 changed files with 5 additions and 1 deletions

View File

@ -1983,6 +1983,7 @@ int sigar_file_system_list_get(sigar_t *sigar,
fs = malloc(len); fs = malloc(len);
if ((num = sigar_getfsstat(fs, len, MNT_NOWAIT)) < 0) { if ((num = sigar_getfsstat(fs, len, MNT_NOWAIT)) < 0) {
free(fs);
return errno; return errno;
} }
@ -2026,6 +2027,7 @@ int sigar_file_system_list_get(sigar_t *sigar,
sigar_fs_type_init(fsp); sigar_fs_type_init(fsp);
} }
free(fs);
return SIGAR_OK; return SIGAR_OK;
} }
@ -2445,8 +2447,10 @@ static int sigar_ifmsg_iter(sigar_t *sigar, ifmsg_iter_t *iter)
case IFMSG_ITER_LIST: case IFMSG_ITER_LIST:
SIGAR_NET_IFLIST_GROW(iter->data.iflist); SIGAR_NET_IFLIST_GROW(iter->data.iflist);
/* sdl_data doesn't include a trailing \0, it is only sdl_nlen long */
name = malloc(sdl->sdl_nlen+1); name = malloc(sdl->sdl_nlen+1);
memcpy(name, sdl->sdl_data, sdl->sdl_nlen+1); memcpy(name, sdl->sdl_data, sdl->sdl_nlen);
name[sdl->sdl_nlen] = '\0'; /* add the missing \0 */
iter->data.iflist->data[iter->data.iflist->number++] = name; iter->data.iflist->data[iter->data.iflist->number++] = name;
break; break;