api: Error checking before NULL dereference
Move error checking of possible null returned value before its dereference in importBuilder.Format Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Tigran Sogomonian <tsogomonian@astralinux.ru>
This commit is contained in:
		
							parent
							
								
									a9b163a757
								
							
						
					
					
						commit
						1fa27ffb62
					
				|  | @ -72,10 +72,10 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai | |||
| 		OverrideConfig:        options.CommitOptions.OverrideConfig, | ||||
| 	} | ||||
| 	importBuilder, err := buildah.ImportBuilder(ctx, c.runtime.store, builderOptions) | ||||
| 	importBuilder.Format = options.PreferredManifestType | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	importBuilder.Format = options.PreferredManifestType | ||||
| 	if options.Author != "" { | ||||
| 		importBuilder.SetMaintainer(options.Author) | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue