Skip to contentSkip to conversation

getnetconfig.c: free linep to avoid memory leakage

PATCH In review Zhi Li 2 participants 2 messages Feb 1, 2023 – Nov 11, 2024

Subsystems (2)
lore
Share & tools
lore

Zhi Li

author
#0 lore raw

PATCH 1/1 getnetconfig.c: free linep to avoid memory leakage

---
 src/getnetconfig.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
src/getnetconfig.c +1 -3
index 9acd8c7..afbf8b5 100644
@@ -507,9 +507,7 @@ getnetconfigent(netid)
 	    break;
 	}
     } while (stringp != NULL);
-    if (ncp == NULL) {
-	free(linep);
-    }
+    free(linep);
     fclose(file);
     return(ncp);
 }
Signature · 1 line
2.39.0
#1 lore raw
Quoted 1 line · Zhi Li

Committed... (tag: libtirpc-1-3-7-rc1)

steved.

Quoted 21 lines
---
  src/getnetconfig.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
src/getnetconfig.c +1 -4
index 9acd8c7..afbf8b5 100644
@@ -507,9 +507,7 @@ getnetconfigent(netid)
  	    break;
  	}
      } while (stringp != NULL);
-    if (ncp == NULL) {
-	free(linep);
-    }
+    free(linep);
      fclose(file);
      return(ncp);
  }
-- 2.39.0