Skip to content

vararg parsing does not properly use the realloced pointer #169

@SamHerts

Description

@SamHerts

Bug:

VARARG_TO_ARGV either mallocs or reallocs a pointer to the argv, but the realloc does not use the new pointer.

else { \
newp = (char **) spindle_realloc(argv, sizeof(char *) * size); \
if (!newp) { \
spindle_free(argv); \
errno = ENOMEM; \
return -1; \
} \
} \

Fix:

 else {                                                         \
    newp = (char **) spindle_realloc(argv, sizeof(char *) * size); \
    if (!newp) {                                                \
       spindle_free(argv);                                      \
       errno = ENOMEM;                                          \
       return -1;                                               \
    }                                                           \
    argv = newp;                                                \
}                                                               \

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions