Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64faef1e authored by Sachin Mohan Gadag's avatar Sachin Mohan Gadag Committed by Gerrit - the friendly Code Review server
Browse files

mm-audio: Remove malloc allocation for ptr pointer

Currently free of ptr pointer is failing because
ptr pointer is not pointing to base address of malloc
function. Reason is, strtoul api stores the address
of the first invalid character of input string parameter
to ptr pointer. Hence removing malloc allocation is not
required as value of ptr pointer will be first invalid
input string address.

Change-Id: I612002b15594b666bf9053c3e49bc62a7efb86ee
parent cb5b5789
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -278,12 +278,6 @@ int get_input_and_validate(char *input, datatype type)
        status = -1;
        goto exit;
    }
    ptr = (char *)malloc(strlen(input) + 1);
    if (ptr == NULL) {
        DEBUG_PRINT("Low memory\n");
        status = -1;
        goto exit;
    }
    /* Check for negative input */
    if (*input == '-') {
        DEBUG_PRINT("Negative Number is not allowed\n");
@@ -322,8 +316,6 @@ int get_input_and_validate(char *input, datatype type)
            break;
    }
exit:
    if (ptr != NULL)
        free(ptr);
    if (status != 0)
        exit(0);
    return value;
+0 −8
Original line number Diff line number Diff line
@@ -291,12 +291,6 @@ int get_input_and_validate(char *input, datatype type)
        status = -1;
        goto exit;
    }
    ptr = (char *)malloc(strlen(input) + 1);
    if (ptr == NULL) {
        DEBUG_PRINT("Low memory\n");
        status = -1;
        goto exit;
    }
    /* Check for negative input */
    if (*input == '-') {
        DEBUG_PRINT("Negative Number is not allowed\n");
@@ -335,8 +329,6 @@ int get_input_and_validate(char *input, datatype type)
            break;
    }
exit:
    if (ptr != NULL)
        free(ptr);
    if (status != 0)
        exit(0);
    return value;
+0 −8
Original line number Diff line number Diff line
@@ -290,12 +290,6 @@ int get_input_and_validate(char *input, datatype type)
        status = -1;
        goto exit;
    }
    ptr = (char *)malloc(strlen(input) + 1);
    if (ptr == NULL) {
        DEBUG_PRINT("Low memory\n");
        status = -1;
        goto exit;
    }
    /* Check for negative input */
    if (*input == '-') {
        DEBUG_PRINT("Negative Number is not allowed\n");
@@ -334,8 +328,6 @@ int get_input_and_validate(char *input, datatype type)
            break;
    }
exit:
    if (ptr != NULL)
        free(ptr);
    if (status != 0)
        exit(0);
    return value;