Call free(cur) if strdup(dirp->d_name) fails to avoid a memory leak.

Reported by:	Coverity
CID:		1007414
MFC after:	1 week
This commit is contained in:
Don Lewis 2016-05-25 00:16:52 +00:00
parent 241adf4455
commit a23f17d3b1

View File

@ -711,6 +711,7 @@ yp_maplist_create(const char *domain)
yp_error("strdup() failed: %s",strerror(errno)); yp_error("strdup() failed: %s",strerror(errno));
closedir(dird); closedir(dird);
yp_maplist_free(yp_maplist); yp_maplist_free(yp_maplist);
free(cur);
return(NULL); return(NULL);
} }
cur->next = yp_maplist; cur->next = yp_maplist;