File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,10 @@ mraa_x86_platform()
102
102
} else {
103
103
platform_type = MRAA_UNKNOWN_PLATFORM ;
104
104
}
105
+
105
106
free (line );
107
+ line = NULL ;
108
+
106
109
}
107
110
fclose (fh );
108
111
} else {
@@ -114,25 +117,29 @@ mraa_x86_platform()
114
117
plat = mraa_intel_sofia_3gr ();
115
118
}
116
119
free (line );
117
- }
120
+ line = NULL ;
121
+ }
118
122
fclose (fh );
119
123
}
120
124
}
125
+
121
126
if (platform_type == MRAA_UNKNOWN_PLATFORM ){
122
127
FILE * file_hold = fopen ("/sys/devices/virtual/dmi/id/product_name" , "r" );
123
- char * platform_name = NULL ;
128
+
124
129
if (file_hold != NULL ) {
125
- if (getline (& platform_name , & len , file_hold ) != -1 ) {
126
- platform_name [ strcspn ( platform_name , "\r\n" )] = 0 ;
127
- if (strncmp (platform_name , "ROScube-I" , strlen ("ROScube-I" )) == 0 ) {
130
+ if (getline (& line , & len , file_hold ) != -1 ) {
131
+
132
+ if (strncmp (line , "ROScube-I" , strlen ("ROScube-I" )) == 0 ) {
128
133
// includes ROScube-I, ROScube-I ET
129
134
platform_type = MRAA_ADLINK_ROSCUBE_I ;
130
135
plat = mraa_roscube_i ();
131
136
} else {
132
137
syslog (LOG_ERR , "Platform not supported, not initialising" );
133
138
platform_type = MRAA_UNKNOWN_PLATFORM ;
134
139
}
135
- free (platform_name );
140
+
141
+ free (line );
142
+ line = NULL ;
136
143
}
137
144
fclose (file_hold );
138
145
}
You can’t perform that action at this time.
0 commit comments