]> granicus.if.org Git - procps-ng/commitdiff
libprocps: open file should be closed, not freed
authorSami Kerola <kerolasa@iki.fi>
Sun, 5 Feb 2012 22:14:32 +0000 (23:14 +0100)
committerSami Kerola <kerolasa@iki.fi>
Mon, 6 Feb 2012 16:37:11 +0000 (17:37 +0100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
proc/slab.c

index 66b0d4b5cd7940c8e2b7727803da1c72b4257863..c1e862486baed83a40b44131d9f91e3ec09b3be2 100644 (file)
@@ -313,13 +313,13 @@ int get_slabinfo(struct slab_info **list, struct slab_stat *stats)
 
        if (!fgets(buffer, SLABINFO_VER_LEN, slabfile)) {
                fprintf(stderr, "cannot read from slabinfo\n");
-               free(slabfile);
+               fclose(slabfile);
                return 1;
        }
 
        if (sscanf(buffer, "slabinfo - version: %d.%d", &major, &minor) != 2) {
                fprintf(stderr, "not the good old slabinfo we know\n");
-               free(slabfile);
+               fclose(slabfile);
                return 1;
        }
 
@@ -331,7 +331,7 @@ int get_slabinfo(struct slab_info **list, struct slab_stat *stats)
                ret = parse_slabinfo10(list, stats, slabfile);
        else {
                fprintf(stderr, "unrecognizable slabinfo version\n");
-               free(slabfile);
+               fclose(slabfile);
                return 1;
        }