File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -266,10 +266,10 @@ socket_is_stale(const char *path)
266266void
267267agent_cleanup_stale (const char * homedir , int ignore_hosthash )
268268{
269- DIR * d ;
269+ DIR * d = NULL ;
270270 struct dirent * dp ;
271271 struct stat sb ;
272- char * prefix = NULL , * dirpath , * path ;
272+ char * prefix = NULL , * dirpath = NULL , * path ;
273273 struct timespec now , sub , * mtimp = NULL ;
274274
275275 /* Only consider sockets last modified > 1 hour ago */
@@ -295,8 +295,7 @@ agent_cleanup_stale(const char *homedir, int ignore_hosthash)
295295 if ((d = opendir (dirpath )) == NULL ) {
296296 if (errno != ENOENT )
297297 error_f ("opendir \"%s\": %s" , dirpath , strerror (errno ));
298- free (dirpath );
299- return ;
298+ goto out ;
300299 }
301300 while ((dp = readdir (d )) != NULL ) {
302301 if (dp -> d_type != DT_SOCK && dp -> d_type != DT_UNKNOWN )
@@ -334,8 +333,9 @@ agent_cleanup_stale(const char *homedir, int ignore_hosthash)
334333 }
335334 free (path );
336335 }
337- closedir (d );
336+ out :
337+ if (d != NULL )
338+ closedir (d );
338339 free (dirpath );
339340 free (prefix );
340341}
341-
You can’t perform that action at this time.
0 commit comments