|
@@ -95,14 +95,18 @@ void image_set_uri ( struct image *image, struct uri *uri ) {
|
95
|
95
|
* Set image command line
|
96
|
96
|
*
|
97
|
97
|
* @v image Image
|
98
|
|
- * @v cmdline New image command line
|
|
98
|
+ * @v cmdline New image command line, or NULL
|
99
|
99
|
* @ret rc Return status code
|
100
|
100
|
*/
|
101
|
101
|
int image_set_cmdline ( struct image *image, const char *cmdline ) {
|
|
102
|
+
|
102
|
103
|
free ( image->cmdline );
|
103
|
|
- image->cmdline = strdup ( cmdline );
|
104
|
|
- if ( ! image->cmdline )
|
105
|
|
- return -ENOMEM;
|
|
104
|
+ image->cmdline = NULL;
|
|
105
|
+ if ( cmdline ) {
|
|
106
|
+ image->cmdline = strdup ( cmdline );
|
|
107
|
+ if ( ! image->cmdline )
|
|
108
|
+ return -ENOMEM;
|
|
109
|
+ }
|
106
|
110
|
return 0;
|
107
|
111
|
}
|
108
|
112
|
|