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, | 		OverrideConfig:        options.CommitOptions.OverrideConfig, | ||||||
| 	} | 	} | ||||||
| 	importBuilder, err := buildah.ImportBuilder(ctx, c.runtime.store, builderOptions) | 	importBuilder, err := buildah.ImportBuilder(ctx, c.runtime.store, builderOptions) | ||||||
| 	importBuilder.Format = options.PreferredManifestType |  | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| 	} | 	} | ||||||
|  | 	importBuilder.Format = options.PreferredManifestType | ||||||
| 	if options.Author != "" { | 	if options.Author != "" { | ||||||
| 		importBuilder.SetMaintainer(options.Author) | 		importBuilder.SetMaintainer(options.Author) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue