File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -314,31 +314,34 @@ int apply_xbc(const char *path, const char *xbc_path)
314
314
ret = delete_xbc (path );
315
315
if (ret < 0 ) {
316
316
pr_err ("Failed to delete previous boot config: %d\n" , ret );
317
+ free (data );
317
318
return ret ;
318
319
}
319
320
320
321
/* Apply new one */
321
322
fd = open (path , O_RDWR | O_APPEND );
322
323
if (fd < 0 ) {
323
324
pr_err ("Failed to open %s: %d\n" , path , fd );
325
+ free (data );
324
326
return fd ;
325
327
}
326
328
/* TODO: Ensure the @path is initramfs/initrd image */
327
329
ret = write (fd , data , size + 8 );
328
330
if (ret < 0 ) {
329
331
pr_err ("Failed to apply a boot config: %d\n" , ret );
330
- return ret ;
332
+ goto out ;
331
333
}
332
334
/* Write a magic word of the bootconfig */
333
335
ret = write (fd , BOOTCONFIG_MAGIC , BOOTCONFIG_MAGIC_LEN );
334
336
if (ret < 0 ) {
335
337
pr_err ("Failed to apply a boot config magic: %d\n" , ret );
336
- return ret ;
338
+ goto out ;
337
339
}
340
+ out :
338
341
close (fd );
339
342
free (data );
340
343
341
- return 0 ;
344
+ return ret ;
342
345
}
343
346
344
347
int usage (void )
You can’t perform that action at this time.
0 commit comments