diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c index f0d82e8120f9..f7656dc712f9 100644 --- a/sbin/geom/core/geom.c +++ b/sbin/geom/core/geom.c @@ -487,13 +487,13 @@ library_path(void) static void load_library(void) { - char *curpath, path[MAXPATHLEN], *totalpath; + char *curpath, path[MAXPATHLEN], *tofree, *totalpath; uint32_t *lib_version; void *dlh; int ret; ret = 0; - totalpath = strdup(library_path()); + tofree = totalpath = strdup(library_path()); if (totalpath == NULL) err(EXIT_FAILURE, "Not enough memory for library path"); @@ -519,7 +519,7 @@ load_library(void) } break; } - free(totalpath); + free(tofree); /* No library was found, but standard commands can still be used */ if (ret == -1) return;