summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/image.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/image.c b/src/core/image.c
index cb9615311..6caa02434 100644
--- a/src/core/image.c
+++ b/src/core/image.c
@@ -95,14 +95,18 @@ void image_set_uri ( struct image *image, struct uri *uri ) {
* Set image command line
*
* @v image Image
- * @v cmdline New image command line
+ * @v cmdline New image command line, or NULL
* @ret rc Return status code
*/
int image_set_cmdline ( struct image *image, const char *cmdline ) {
+
free ( image->cmdline );
- image->cmdline = strdup ( cmdline );
- if ( ! image->cmdline )
- return -ENOMEM;
+ image->cmdline = NULL;
+ if ( cmdline ) {
+ image->cmdline = strdup ( cmdline );
+ if ( ! image->cmdline )
+ return -ENOMEM;
+ }
return 0;
}