]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/radius/clientid.c
Update README to fix an error
[ppp.git] / pppd / plugins / radius / clientid.c
index 09ec3d04c56346e309d0c209690214dcbe9dd3d8..bf26947a0fa49e227b3a0f024b3ce194dd0278ed 100644 (file)
@@ -68,10 +68,15 @@ int rc_read_mapfile(char *filename)
 
                        if ((p = (struct map2id_s *)malloc(sizeof(*p))) == NULL) {
                                novm("rc_read_mapfile");
+                               fclose(mapfd);
                                return (-1);
                        }
 
-                       p->name = strdup(name);
+                       if ((p->name = strdup(name)) == NULL) {
+                               novm("rc_read_mapfile");
+                               fclose(mapfd);
+                               return (-1);
+                       }
                        p->id = atoi(id);
                        p->next = map2id_list;
                        map2id_list = p;
@@ -79,6 +84,7 @@ int rc_read_mapfile(char *filename)
                } else {
 
                        error("rc_read_mapfile: malformed line in %s, line %d", filename, lnr);
+                       fclose(mapfd);
                        return (-1);
 
                }
@@ -101,7 +107,7 @@ int rc_read_mapfile(char *filename)
  * Returns: port id, zero if no entry found
  */
 
-UINT4 rc_map2id(char *name)
+UINT4 rc_map2id(const char *name)
 {
        struct map2id_s *p;
        char ttyname[PATH_MAX];