]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix invalid check
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 6 Nov 2019 16:59:51 +0000 (10:59 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 6 Nov 2019 16:59:51 +0000 (10:59 -0600)
src/modules/proto_dhcpv4/dhcpclient.c

index e2d84e45538c900a601bdb427bab33bd27f33421..67d2545d18593082fe1a542b1ac2c939f1505d4f 100644 (file)
@@ -172,7 +172,7 @@ static RADIUS_PACKET *request_init(char const *filename)
        if (fr_pair_list_afrom_file(request, dict_dhcpv4, &request->vps, fp, &filedone) < 0) {
                fr_perror("dhcpclient");
                fr_radius_packet_free(&request);
-               if (fp != stdin) fclose(fp);
+               if (fp && (fp != stdin)) fclose(fp);
                return NULL;
        }
 
@@ -191,7 +191,7 @@ static RADIUS_PACKET *request_init(char const *filename)
                        if (fr_value_box_from_str(vp, &vp->data, &type, NULL, vp->xlat, -1, '\0', false) < 0) {
                                fr_perror("dhcpclient");
                                fr_radius_packet_free(&request);
-                               if (fp != stdin) fclose(fp);
+                               if (fp && (fp != stdin)) fclose(fp);
                                return NULL;
                        }
                        vp->type = VT_DATA;
@@ -228,7 +228,7 @@ static RADIUS_PACKET *request_init(char const *filename)
 
        } /* loop over the VP's we read in */
 
-       if (fp != stdin) fclose(fp);
+       if (fp && (fp != stdin)) fclose(fp);
 
        /*
         *      And we're done.