Re: [PATCH] Pass size of structure not a size of ointer to calloc (#592227)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ack.

On 06/30/2010 04:35 PM, Martin Sivak wrote:
---
  loader/hdinstall.c  |    2 +-
  loader/method.c     |    8 ++++----
  loader/nfsinstall.c |    2 +-
  loader/urlinstall.c |    2 +-
  4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/loader/hdinstall.c b/loader/hdinstall.c
index 979ccf0..1b28ab1 100644
--- a/loader/hdinstall.c
+++ b/loader/hdinstall.c
@@ -386,7 +386,7 @@ void setKickstartHD(struct loaderData_s * loaderData, int argc,
      }

      loaderData->method = METHOD_HD;
-    loaderData->stage2Data = calloc(sizeof(struct hdInstallData *), 1);
+    loaderData->stage2Data = calloc(sizeof(struct hdInstallData), 1);
      if (partition)
          ((struct hdInstallData *)loaderData->stage2Data)->partition = partition;
      if (dir)
diff --git a/loader/method.c b/loader/method.c
index 219fd06..9bb47d0 100644
--- a/loader/method.c
+++ b/loader/method.c
@@ -510,7 +510,7 @@ void setStage2LocFromCmdline(char * arg, struct loaderData_s * ld) {

          if (!strncmp(arg, "nfs:", 4)) {
              ld->method = METHOD_NFS;
-            ld->stage2Data = calloc(sizeof(struct nfsInstallData *), 1);
+            ld->stage2Data = calloc(sizeof(struct nfsInstallData), 1);

              parseNfsHostPathOpts(arg + 4,
                &(((struct nfsInstallData *)ld->stage2Data)->host),
@@ -518,7 +518,7 @@ void setStage2LocFromCmdline(char * arg, struct loaderData_s * ld) {
                &(((struct nfsInstallData *)ld->stage2Data)->mountOpts));
          } else if (!strncmp(arg, "nfsiso:", 7)) {
              ld->method = METHOD_NFS;
-            ld->stage2Data = calloc(sizeof(struct nfsInstallData *), 1);
+            ld->stage2Data = calloc(sizeof(struct nfsInstallData), 1);

              parseNfsHostPathOpts(arg + 7,
                &(((struct nfsInstallData *)ld->stage2Data)->host),
@@ -527,14 +527,14 @@ void setStage2LocFromCmdline(char * arg, struct loaderData_s * ld) {
          } else if (!strncmp(arg, "ftp:", 4) ||
                     !strncmp(arg, "http", 4)) {
              ld->method = METHOD_URL;
-            ld->stage2Data = calloc(sizeof(struct urlInstallData *), 1);
+            ld->stage2Data = calloc(sizeof(urlInstallData), 1);
              ((urlInstallData *)ld->stage2Data)->url = strdup(arg);
          } else if (!strncmp(arg, "cdrom:", 6)) {
              ld->method = METHOD_CDROM;
          } else if (!strncmp(arg, "harddrive:", 10) ||
                     !strncmp(arg, "hd:", 3)) {
              ld->method = METHOD_HD;
-            ld->stage2Data = calloc(sizeof(struct hdInstallData *), 1);
+            ld->stage2Data = calloc(sizeof(struct hdInstallData), 1);
              ((struct hdInstallData *)ld->stage2Data)->partition = strdup(c);
              if ((c = strtok(NULL, ":")))
                  ((struct hdInstallData *)ld->stage2Data)->directory = strdup(c);
diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c
index 09a2109..21e029d 100644
--- a/loader/nfsinstall.c
+++ b/loader/nfsinstall.c
@@ -406,7 +406,7 @@ void setKickstartNfs(struct loaderData_s * loaderData, int argc,
          logMessage(INFO, "results of nfs, host is %s, dir is %s, opts are '%s'",
                     host, dir, mountOpts);
      } else {
-        loaderData->stage2Data = calloc(sizeof(struct nfsInstallData *), 1);
+        loaderData->stage2Data = calloc(sizeof(struct nfsInstallData), 1);
          ((struct nfsInstallData *)loaderData->stage2Data)->host = host;
          ((struct nfsInstallData *)loaderData->stage2Data)->directory = dir;
          ((struct nfsInstallData *)loaderData->stage2Data)->mountOpts = mountOpts;
diff --git a/loader/urlinstall.c b/loader/urlinstall.c
index 53d73b7..962ad4e 100644
--- a/loader/urlinstall.c
+++ b/loader/urlinstall.c
@@ -396,7 +396,7 @@ void setKickstartUrl(struct loaderData_s * loaderData, int argc,
      if (!substr || (substr&&  *(substr+4) != '\0')) {
          loaderData->instRepo = strdup(url);
      } else {
-        if ((loaderData->stage2Data = calloc(sizeof(urlInstallData *), 1)) == NULL)
+        if ((loaderData->stage2Data = calloc(sizeof(urlInstallData), 1)) == NULL)
              return;

          ((urlInstallData *)loaderData->stage2Data)->url = url;

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux