extendVar should only reset val_used only when newSize is greater than the
authorPavan Deolasee <[email protected]>
Fri, 1 Apr 2016 06:25:43 +0000 (11:55 +0530)
committerPavan Deolasee <[email protected]>
Tue, 18 Oct 2016 10:05:04 +0000 (15:35 +0530)
current value of val_used

contrib/pgxc_ctl/variables.c

index 6d9be1023013d68fa935da82e008bc1bdc7bf0c8..b946dfb2f45f6cf89dbd7c441dd676f6ab0f079d 100644 (file)
@@ -422,7 +422,8 @@ int extendVar(char *name, int newSize, char *def_value)
 
        /* Store NULL in the last element to mark the end-of-array */
        (target->val)[newSize] = NULL;
-       target->val_used = newSize;
+       if (target->val_used < newSize)
+               target->val_used = newSize;
        
        return 0;
 }