소스 검색

dselect: Fix memory leak on inexistent method directory

Guillem Jover 16 년 전
부모
커밋
5abafe0fe6
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      dselect/methparse.cc

+ 4 - 1
dselect/methparse.cc

@@ -83,7 +83,10 @@ void readmethods(const char *pathbase, dselect_option **optionspp, int *nread) {
 
   dir= opendir(pathbuf);
   if (!dir) {
-    if (errno == ENOENT) return;
+    if (errno == ENOENT) {
+      delete[] pathbuf;
+      return;
+    }
     ohshite(_("unable to read `%.250s' directory for reading methods"),pathbuf);
   }