mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-05 10:38:08 +01:00
glib/goption.c: Replace precondition with assertion
A static analysis run noted that we weren't freeing the cmdline in the error path here. We can just make this an assertion instead; I just checked the kernel code, and it just usees a seq_printf() here which will NUL terminate.
This commit is contained in:
parent
649faee0e6
commit
651e3b05d8
@ -1829,9 +1829,10 @@ platform_get_argv0 (void)
|
|||||||
&len,
|
&len,
|
||||||
NULL))
|
NULL))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Sanity check for a NUL terminator. */
|
/* Sanity check for a NUL terminator. */
|
||||||
if (!memchr (cmdline, 0, len))
|
g_assert (memchr (cmdline, 0, len));
|
||||||
return NULL;
|
|
||||||
/* We could just return cmdline, but I think it's better
|
/* We could just return cmdline, but I think it's better
|
||||||
* to hold on to a smaller malloc block; the arguments
|
* to hold on to a smaller malloc block; the arguments
|
||||||
* could be large.
|
* could be large.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user