From e5cf4c4d48139cfc65133f4fbfe5b0a94e1611ff Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Mon, 21 Apr 2008 23:32:10 +0000 Subject: [PATCH] Checking result of strdup() --- src/view.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/view.c b/src/view.c index 46321ae..3fb8674 100644 --- a/src/view.c +++ b/src/view.c @@ -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;