]> git.mdlowis.com Git - projs/opts.git/commitdiff
Initialize empty argument list to contain NULL for the end slot
authorMichael D. Lowis <mike@mdlowis.com>
Mon, 3 Nov 2014 23:48:06 +0000 (18:48 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Mon, 3 Nov 2014 23:48:06 +0000 (18:48 -0500)
source/opts.c

index ad13f273fd6afe71b5095b95095a967bf5c1f8ed..db00d7a40dcf8663b3e1d6b13c94903a09d29861 100755 (executable)
@@ -301,6 +301,7 @@ const char** opts_select(const char* name, const char* tag) {
 const char** opts_arguments(void) {
     size_t index = 0;
     const char** ret = (const char**)malloc(sizeof(const char*));
+    ret[0] = NULL;
     entry_t* entry = Arguments;
     while (NULL != entry) {
         ret = (const char**)realloc(ret, (index+2)*sizeof(const char*));