Quellcode durchsuchen

dselect: Fix memory leak on inexistent method directory

Guillem Jover vor 16 Jahren
Ursprung
Commit
5abafe0fe6
1 geänderte Dateien mit 4 neuen und 1 gelöschten Zeilen
  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);
   }