Checking result of strdup()

This commit is contained in:
Pierre Pronchery 2008-04-21 23:32:10 +00:00
parent becfb362aa
commit e5cf4c4d48

View File

@ -133,11 +133,11 @@ static View * _view_new(char const * pathname)
if((view = malloc(sizeof(*view))) == NULL)
return NULL; /* FIXME handle error */
view->pathname = strdup(pathname);
view->window = NULL;
view->ab_window = NULL;
_view_cnt++;
if(lstat(pathname, &st) != 0)
if((view->pathname = strdup(pathname)) == NULL
|| lstat(pathname, &st) != 0)
{
_view_error(view, strerror(errno), 2);
return NULL;